ReactOS  0.4.12-dev-14-gd0c8636
tray.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Sound Volume Control
4  * FILE: base/applications/sndvol32/tray.c
5  * PROGRAMMERS: Eric Kohl <eric.kohl@reactos.org>
6  */
7 
8 #include "sndvol32.h"
9 
10 static VOID
12  HWND hwnd,
13  WPARAM wParam,
14  LPARAM lParam)
15 {
16  POINT ptCursor;
17  RECT rcWindow;
18  RECT rcScreen;
19  LONG x, y, cx, cy;
20 
21  GetCursorPos(&ptCursor);
22 
23  GetWindowRect(hwnd, &rcWindow);
24 
25  GetWindowRect(GetDesktopWindow(), &rcScreen);
26 
27  cx = rcWindow.right - rcWindow.left;
28  cy = rcWindow.bottom - rcWindow.top;
29 
30  if (ptCursor.y + cy > rcScreen.bottom)
31  y = ptCursor.y - cy;
32  else
33  y = ptCursor.y;
34 
35  if (ptCursor.x + cx > rcScreen.right)
36  x = ptCursor.x - cx;
37  else
38  x = ptCursor.x;
39 
40  SetWindowPos(hwnd, HWND_TOPMOST, x, y, 0, 0, SWP_NOSIZE);
41 
42  /* Disable the controls for now */
45 }
46 
47 
48 INT_PTR
51  HWND hwndDlg,
52  UINT uMsg,
53  WPARAM wParam,
54  LPARAM lParam)
55 {
56  switch (uMsg)
57  {
58  case WM_INITDIALOG:
59  OnTrayInitDialog(hwndDlg, wParam, lParam);
60  break;
61 
62  case WM_ACTIVATE:
63  if (LOWORD(wParam) == WA_INACTIVE)
64  EndDialog(hwndDlg, IDOK);
65  break;
66  }
67 
68  return 0;
69 }
70 
71 /* EOF */
#define IDC_LINE_SLIDER_VERT
Definition: resources.h:25
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define CALLBACK
Definition: compat.h:27
LONG top
Definition: windef.h:297
#define HWND_TOPMOST
Definition: winuser.h:1194
LONG left
Definition: windef.h:296
int32_t INT_PTR
Definition: typedefs.h:62
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
LONG right
Definition: windef.h:298
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
UINT_PTR WPARAM
Definition: windef.h:207
static VOID OnTrayInitDialog(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: tray.c:11
INT INT y
Definition: msvc.h:62
long LONG
Definition: pedump.c:60
LONG_PTR LPARAM
Definition: windef.h:208
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SWP_NOSIZE
Definition: winuser.h:1230
#define WM_ACTIVATE
Definition: winuser.h:1594
INT x
Definition: msvc.h:62
_Out_opt_ int * cx
Definition: commctrl.h:570
INT_PTR CALLBACK TrayDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: tray.c:50
LONG bottom
Definition: windef.h:299
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WA_INACTIVE
Definition: winuser.h:2576
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_LINE_SWITCH
Definition: resources.h:23