foobar2000 SDK  2015-08-03
Namespaces | Functions
win-objects.cpp File Reference

Go to the source code of this file.

Namespaces

 pfc
 

Functions

unsigned GetHotkeyModifierFlags ()
 
WORD GetWindowsVersionCode () throw ()
 
bool pfc::isAltKeyPressed ()
 
bool pfc::isCtrlKeyPressed ()
 
bool IsKeyPressed (unsigned vk)
 
bool IsPointInsideControl (const POINT &pt, HWND wnd)
 
bool pfc::isShiftKeyPressed ()
 
bool IsWindowChildOf (HWND child, HWND parent)
 
unsigned MapDialogWidth (HWND p_dialog, unsigned p_value)
 
void uAddWindowExStyle (HWND p_wnd, LONG p_style)
 
void uAddWindowStyle (HWND p_wnd, LONG p_style)
 
void uRemoveWindowExStyle (HWND p_wnd, LONG p_style)
 
void uRemoveWindowStyle (HWND p_wnd, LONG p_style)
 
void uSleepSeconds (double p_time, bool p_alertable)
 

Function Documentation

unsigned GetHotkeyModifierFlags ( )

Returns current modifier keys pressed, using win32 MOD_* flags.

Definition at line 130 of file win-objects.cpp.

130  {
131  unsigned ret = 0;
132  if (IsKeyPressed(VK_CONTROL)) ret |= MOD_CONTROL;
133  if (IsKeyPressed(VK_SHIFT)) ret |= MOD_SHIFT;
134  if (IsKeyPressed(VK_MENU)) ret |= MOD_ALT;
135  if (IsKeyPressed(VK_LWIN) || IsKeyPressed(VK_RWIN)) ret |= MOD_WIN;
136  return ret;
137 }
bool IsKeyPressed(unsigned vk)
WORD GetWindowsVersionCode ( )
throw (
)

Definition at line 296 of file win-objects.cpp.

296  {
297  const DWORD ver = GetVersion();
298  return (WORD)HIBYTE(LOWORD(ver)) | ((WORD)LOBYTE(LOWORD(ver)) << 8);
299 }
bool IsKeyPressed ( unsigned  vk)

Definition at line 125 of file win-objects.cpp.

125  {
126  return (GetKeyState(vk) & 0x8000) ? true : false;
127 }
bool IsPointInsideControl ( const POINT &  pt,
HWND  wnd 
)

Definition at line 165 of file win-objects.cpp.

165  {
166  HWND walk = WindowFromPoint(pt);
167  for(;;) {
168  if (walk == NULL) return false;
169  if (walk == wnd) return true;
170  if (GetWindowLong(walk,GWL_STYLE) & WS_POPUP) return false;
171  walk = GetParent(walk);
172  }
173 }
bool IsWindowChildOf ( HWND  child,
HWND  parent 
)

Definition at line 175 of file win-objects.cpp.

175  {
176  HWND walk = child;
177  while(walk != parent && walk != NULL && (GetWindowLong(walk,GWL_STYLE) & WS_CHILD) != 0) {
178  walk = GetParent(walk);
179  }
180  return walk == parent;
181 }
unsigned MapDialogWidth ( HWND  p_dialog,
unsigned  p_value 
)

Definition at line 118 of file win-objects.cpp.

118  {
119  RECT temp;
120  temp.left = 0; temp.right = p_value; temp.top = temp.bottom = 0;
121  if (!MapDialogRect(p_dialog,&temp)) return 0;
122  return temp.right;
123 }
void uAddWindowExStyle ( HWND  p_wnd,
LONG  p_style 
)

Definition at line 110 of file win-objects.cpp.

110  {
111  SetWindowLong(p_wnd,GWL_EXSTYLE, GetWindowLong(p_wnd,GWL_EXSTYLE) | p_style);
112 }
void uAddWindowStyle ( HWND  p_wnd,
LONG  p_style 
)

Definition at line 102 of file win-objects.cpp.

102  {
103  SetWindowLong(p_wnd,GWL_STYLE, GetWindowLong(p_wnd,GWL_STYLE) | p_style);
104 }
void uRemoveWindowExStyle ( HWND  p_wnd,
LONG  p_style 
)

Definition at line 114 of file win-objects.cpp.

114  {
115  SetWindowLong(p_wnd,GWL_EXSTYLE, GetWindowLong(p_wnd,GWL_EXSTYLE) & ~p_style);
116 }
void uRemoveWindowStyle ( HWND  p_wnd,
LONG  p_style 
)

Definition at line 106 of file win-objects.cpp.

106  {
107  SetWindowLong(p_wnd,GWL_STYLE, GetWindowLong(p_wnd,GWL_STYLE) & ~p_style);
108 }
void uSleepSeconds ( double  p_time,
bool  p_alertable 
)

Definition at line 289 of file win-objects.cpp.

289  {
290  SleepEx(win32_event::g_calculate_wait_time(p_time),p_alertable ? TRUE : FALSE);
291 }
static DWORD g_calculate_wait_time(double p_seconds)