foobar2000 SDK  2015-01-14
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 127 of file win-objects.cpp.

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

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

285  {
286  const DWORD ver = GetVersion();
287  return (WORD)HIBYTE(LOWORD(ver)) | ((WORD)LOBYTE(LOWORD(ver)) << 8);
288 }
bool IsKeyPressed ( unsigned  vk)

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

122  {
123  return (GetKeyState(vk) & 0x8000) ? true : false;
124 }
bool IsPointInsideControl ( const POINT &  pt,
HWND  wnd 
)

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

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

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

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

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

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

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

107  {
108  SetWindowLong(p_wnd,GWL_EXSTYLE, GetWindowLong(p_wnd,GWL_EXSTYLE) | p_style);
109 }
void uAddWindowStyle ( HWND  p_wnd,
LONG  p_style 
)

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

99  {
100  SetWindowLong(p_wnd,GWL_STYLE, GetWindowLong(p_wnd,GWL_STYLE) | p_style);
101 }
void uRemoveWindowExStyle ( HWND  p_wnd,
LONG  p_style 
)

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

111  {
112  SetWindowLong(p_wnd,GWL_EXSTYLE, GetWindowLong(p_wnd,GWL_EXSTYLE) & ~p_style);
113 }
void uRemoveWindowStyle ( HWND  p_wnd,
LONG  p_style 
)

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

103  {
104  SetWindowLong(p_wnd,GWL_STYLE, GetWindowLong(p_wnd,GWL_STYLE) & ~p_style);
105 }
void uSleepSeconds ( double  p_time,
bool  p_alertable 
)

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

280  {
281  SleepEx(win32_event::g_calculate_wait_time(p_time),p_alertable ? TRUE : FALSE);
282 }
static DWORD g_calculate_wait_time(double p_seconds)