ReactOS  0.4.12-dev-36-g472787f
main.c File Reference
#include "osk.h"
#include "settings.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

int OSK_SetImage (int IdDlgItem, int IdResource)
 
int OSK_DlgInitDialog (HWND hDlg)
 
int OSK_DlgClose (void)
 
int OSK_DlgTimer (void)
 
BOOL OSK_DlgCommand (WPARAM wCommand, HWND hWndControl)
 
BOOL OSK_ReleaseKey (WORD ScanCode)
 
INT_PTR APIENTRY OSK_DlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
int WINAPI _tWinMain (HINSTANCE, HINSTANCE, LPTSTR, int)
 
INT_PTR CALLBACK OSK_WarningProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 

Variables

OSK_GLOBALS Globals
 

Function Documentation

◆ _tWinMain()

int WINAPI _tWinMain ( HINSTANCE  hInstance,
HINSTANCE  prev,
LPTSTR  cmdline,
int  show 
)

Definition at line 422 of file main.c.

426 {
427  HANDLE hMutex;
428 
432 
433  ZeroMemory(&Globals, sizeof(Globals));
435 
436  /* Rry to open a mutex for a single instance */
437  hMutex = OpenMutexA(MUTEX_ALL_ACCESS, FALSE, "osk");
438 
439  if (!hMutex)
440  {
441  /* Mutex doesn’t exist. This is the first instance so create the mutex. */
442  hMutex = CreateMutexA(NULL, FALSE, "osk");
443 
444  DialogBox(hInstance,
447  OSK_DlgProc);
448 
449  /* Delete the mutex */
450  if (hMutex) CloseHandle(hMutex);
451  }
452  else
453  {
454  /* Programme already launched */
455 
456  /* Delete the mutex */
457  CloseHandle(hMutex);
458 
459  ExitProcess(0);
460  }
461 
462  return 0;
463 }
INT_PTR APIENTRY OSK_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:367
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define CloseHandle
Definition: compat.h:398
NOTEPAD_GLOBALS Globals
Definition: main.c:29
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1517
#define ZeroMemory
Definition: winbase.h:1635
#define MAIN_DIALOG
Definition: osk_res.h:9
TCHAR * cmdline
Definition: stretchblt.cpp:32
HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
Definition: synch.c:538
#define MUTEX_ALL_ACCESS
Definition: winbase.h:158
HINSTANCE hInstance
Definition: main.h:59
#define DialogBox
Definition: winuser.h:5627
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
HANDLE hMutex
Definition: mutex.c:11
HINSTANCE hInstance
Definition: main.c:36
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:509

◆ OSK_DlgClose()

int OSK_DlgClose ( void  )

Definition at line 189 of file main.c.

Referenced by OSK_DlgProc().

190 {
192 
193  /* Release Ctrl, Shift, Alt keys */
194  OSK_ReleaseKey(SCAN_CODE_44); // Left shift
195  OSK_ReleaseKey(SCAN_CODE_57); // Right shift
196  OSK_ReleaseKey(SCAN_CODE_58); // Left ctrl
197  OSK_ReleaseKey(SCAN_CODE_60); // Left alt
198  OSK_ReleaseKey(SCAN_CODE_62); // Right alt
199  OSK_ReleaseKey(SCAN_CODE_64); // Right ctrl
200 
201  /* delete GDI objects */
202  if (Globals.hBrushGreenLed) DeleteObject(Globals.hBrushGreenLed);
203 
204  /* Save the settings to the registry hive */
206 
207  return TRUE;
208 }
#define TRUE
Definition: types.h:120
#define SCAN_CODE_60
Definition: osk_res.h:97
NOTEPAD_GLOBALS Globals
Definition: main.c:29
#define SCAN_CODE_64
Definition: osk_res.h:100
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define SCAN_CODE_62
Definition: osk_res.h:99
#define SCAN_CODE_57
Definition: osk_res.h:95
#define SCAN_CODE_58
Definition: osk_res.h:96
BOOL SaveDataToRegistry()
Definition: settings.c:61
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
BOOL OSK_ReleaseKey(WORD ScanCode)
Definition: main.c:328
#define SCAN_CODE_44
Definition: osk_res.h:83
HWND hMainWnd
Definition: main.h:60

◆ OSK_DlgCommand()

BOOL OSK_DlgCommand ( WPARAM  wCommand,
HWND  hWndControl 
)

Definition at line 241 of file main.c.

Referenced by OSK_DlgProc().

242 {
243  WORD ScanCode;
244  INPUT Input;
245  BOOL bExtendedKey;
246  BOOL bKeyDown;
247  BOOL bKeyUp;
248  LONG WindowStyle;
249 
250  /* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
251  if (Globals.hActiveWnd)
252  {
253  MSG msg;
254 
255  SetForegroundWindow(Globals.hActiveWnd);
256  while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
257  {
258  TranslateMessage(&msg);
259  DispatchMessage(&msg);
260  }
261  }
262 
263  /* KeyDown and/or KeyUp ? */
264  WindowStyle = GetWindowLong(hWndControl, GWL_STYLE);
265  if ((WindowStyle & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX)
266  {
267  /* 2-states key like Shift, Alt, Ctrl, ... */
268  if (SendMessage(hWndControl, BM_GETCHECK, 0, 0) == BST_CHECKED)
269  {
270  bKeyDown = TRUE;
271  bKeyUp = FALSE;
272  }
273  else
274  {
275  bKeyDown = FALSE;
276  bKeyUp = TRUE;
277  }
278  }
279  else
280  {
281  /* Other key */
282  bKeyDown = TRUE;
283  bKeyUp = TRUE;
284  }
285 
286  /* Extended key ? */
287  ScanCode = wCommand;
288  if (ScanCode & 0x0200)
289  bExtendedKey = TRUE;
290  else
291  bExtendedKey = FALSE;
292  ScanCode &= 0xFF;
293 
294  /* Press and release the key */
295  if (bKeyDown)
296  {
297  Input.type = INPUT_KEYBOARD;
298  Input.ki.wVk = 0;
299  Input.ki.wScan = ScanCode;
300  Input.ki.time = GetTickCount();
302  Input.ki.dwFlags = KEYEVENTF_SCANCODE;
303  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
304  SendInput(1, &Input, sizeof(Input));
305  }
306 
307  if (bKeyUp)
308  {
309  Input.type = INPUT_KEYBOARD;
310  Input.ki.wVk = 0;
311  Input.ki.wScan = ScanCode;
312  Input.ki.time = GetTickCount();
314  Input.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
315  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
316  SendInput(1, &Input, sizeof(Input));
317  }
318 
319  return TRUE;
320 }
#define DispatchMessage
Definition: winuser.h:5631
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define PeekMessage
Definition: winuser.h:5696
#define TRUE
Definition: types.h:120
NOTEPAD_GLOBALS Globals
Definition: main.c:29
ULONG ScanCode
Definition: api.c:39
#define KEYEVENTF_KEYUP
Definition: winuser.h:1092
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
Definition: arc.h:84
DWORD time
Definition: winable.h:50
#define INPUT_KEYBOARD
Definition: winable.h:10
long LONG
Definition: pedump.c:60
LPARAM WINAPI GetMessageExtraInfo(void)
Definition: message.c:1315
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BM_GETCHECK
Definition: winuser.h:1879
DWORD dwFlags
Definition: winable.h:49
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
#define GetWindowLong
Definition: winuser.h:5662
#define GWL_STYLE
Definition: winuser.h:846
DWORD type
Definition: winable.h:59
WORD wScan
Definition: winable.h:48
#define KEYEVENTF_EXTENDEDKEY
Definition: winuser.h:1091
#define BST_CHECKED
Definition: winuser.h:197
#define msg(x)
Definition: auth_time.c:54
#define SendMessage
Definition: winuser.h:5709
BOOL WINAPI SetForegroundWindow(_In_ HWND)
ULONG_PTR dwExtraInfo
Definition: winable.h:51
#define PM_REMOVE
Definition: winuser.h:1182
WORD wVk
Definition: winable.h:47
UINT WINAPI SendInput(UINT, LPINPUT, int)
Definition: ntwrapper.h:344
KEYBDINPUT ki
Definition: winable.h:62

◆ OSK_DlgInitDialog()

int OSK_DlgInitDialog ( HWND  hDlg)

Definition at line 109 of file main.c.

Referenced by OSK_DlgProc().

110 {
112  HMONITOR monitor;
114  POINT Pt;
115  RECT rcWindow;
116 
117  /* Save handle */
118  Globals.hMainWnd = hDlg;
119 
120  /* Load the settings from the registry hive */
122 
123  /* Set the application's icon */
126  if (hIcon || hIconSm)
127  {
128  /* Set the window icons (they are deleted when the process terminates) */
129  SendMessageW(Globals.hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
130  SendMessageW(Globals.hMainWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
131  }
132 
133  /* Get screen info */
134  memset(&Pt, 0, sizeof(Pt));
135  monitor = MonitorFromPoint(Pt, MONITOR_DEFAULTTOPRIMARY);
136  info.cbSize = sizeof(info);
137  GetMonitorInfoW(monitor, &info);
138 
139  /* Move the dialog on the bottom of main screen */
140  GetWindowRect(hDlg, &rcWindow);
141  MoveWindow(hDlg,
142  (info.rcMonitor.left + info.rcMonitor.right) / 2 - // Center of screen
143  (rcWindow.right - rcWindow.left) / 2, // - half size of dialog
144  info.rcMonitor.bottom - // Bottom of screen
145  (rcWindow.bottom - rcWindow.top), // - size of window
146  rcWindow.right - rcWindow.left, // Width
147  rcWindow.bottom - rcWindow.top, // Height
148  TRUE);
149 
150  /* Set icon on visual buttons */
167 
168  /* Create a green brush for leds */
169  Globals.hBrushGreenLed = CreateSolidBrush(RGB(0, 255, 0));
170 
171  /* Set a timer for periodics tasks */
172  Globals.iTimer = SetTimer(hDlg, 0, 200, NULL);
173 
174  /* If the member of the struct (bShowWarning) is set then display the dialog box */
175  if (Globals.bShowWarning)
176  {
178  }
179 
180  return TRUE;
181 }
#define SCAN_CODE_30
Definition: osk_res.h:69
HMONITOR WINAPI MonitorFromPoint(POINT, DWORD)
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
NOTEPAD_GLOBALS Globals
Definition: main.c:29
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define SCAN_CODE_128
Definition: osk_res.h:146
#define IDI_PG_UP
Definition: osk_res.h:25
#define IDI_OSK
Definition: osk_res.h:16
LONG top
Definition: windef.h:297
#define IDI_RIGHT
Definition: osk_res.h:29
#define SM_CYSMICON
Definition: winuser.h:1003
#define SCAN_CODE_79
Definition: osk_res.h:103
#define IDI_TOP
Definition: osk_res.h:28
#define IDI_TAB
Definition: osk_res.h:18
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
#define IDI_SHIFT
Definition: osk_res.h:21
RECT rcMonitor
Definition: winuser.h:3727
#define ICON_SMALL
Definition: tnclass.cpp:48
struct _test_info info[]
Definition: SetCursorPos.c:19
HINSTANCE hInstance
Definition: main.h:59
#define SCAN_CODE_80
Definition: osk_res.h:104
#define DialogBox
Definition: winuser.h:5627
#define SCAN_CODE_16
Definition: osk_res.h:55
#define IDI_LEFT
Definition: osk_res.h:27
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
LONG_PTR LPARAM
Definition: windef.h:208
int OSK_SetImage(int IdDlgItem, int IdResource)
Definition: main.c:37
#define IDI_BACK
Definition: osk_res.h:17
#define SCAN_CODE_57
Definition: osk_res.h:95
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
#define IDI_MENU
Definition: osk_res.h:23
#define IDI_HOME
Definition: osk_res.h:24
#define SCAN_CODE_86
Definition: osk_res.h:109
smooth NULL
Definition: ftsmooth.c:416
BOOL LoadDataFromRegistry()
Definition: settings.c:15
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDI_CAPS_LOCK
Definition: osk_res.h:19
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define RGB(r, g, b)
Definition: wingdi.h:2917
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
#define IDI_REACTOS
Definition: osk_res.h:22
#define SCAN_CODE_89
Definition: osk_res.h:110
INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:67
#define SCAN_CODE_15
Definition: osk_res.h:54
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define IDI_RETURN
Definition: osk_res.h:20
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1089
#define SCAN_CODE_127
Definition: osk_res.h:145
HICON hIcon
Definition: msconfig.c:44
#define SCAN_CODE_84
Definition: osk_res.h:107
DWORD cbSize
Definition: winuser.h:3726
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDI_BOTTOM
Definition: osk_res.h:30
#define SCAN_CODE_43
Definition: osk_res.h:82
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define IDD_WARNINGDIALOG_OSK
Definition: osk_res.h:32
HICON hIconSm
Definition: msconfig.c:44
LONG bottom
Definition: windef.h:299
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SCAN_CODE_85
Definition: osk_res.h:108
#define SCAN_CODE_44
Definition: osk_res.h:83
#define SCAN_CODE_83
Definition: osk_res.h:106
#define memset(x, y, z)
Definition: compat.h:39
HWND hMainWnd
Definition: main.h:60
#define IDI_PG_DOWN
Definition: osk_res.h:26
#define ICON_BIG
Definition: tnclass.cpp:51
#define SCAN_CODE_129
Definition: osk_res.h:147

◆ OSK_DlgProc()

INT_PTR APIENTRY OSK_DlgProc ( HWND  hDlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 367 of file main.c.

Referenced by _tWinMain().

368 {
369  switch (msg)
370  {
371  case WM_INITDIALOG:
372  OSK_DlgInitDialog(hDlg);
373  return TRUE;
374 
375  case WM_TIMER:
376  OSK_DlgTimer();
377  return TRUE;
378 
379  case WM_CTLCOLORSTATIC:
380  if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_NUM))
381  {
382  if (GetKeyState(VK_NUMLOCK) & 0x0001)
383  return (INT_PTR)Globals.hBrushGreenLed;
384  else
386  }
387  if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_CAPS))
388  {
389  if (GetKeyState(VK_CAPITAL) & 0x0001)
390  return (INT_PTR)Globals.hBrushGreenLed;
391  else
393  }
394  if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_SCROLL))
395  {
396  if (GetKeyState(VK_SCROLL) & 0x0001)
397  return (INT_PTR)Globals.hBrushGreenLed;
398  else
400  }
401  break;
402 
403  case WM_COMMAND:
404  if (wParam == IDCANCEL)
405  EndDialog(hDlg, FALSE);
406  else if (wParam != IDC_STATIC)
408  break;
409 
410  case WM_CLOSE:
411  OSK_DlgClose();
412  break;
413  }
414 
415  return 0;
416 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
int OSK_DlgClose(void)
Definition: main.c:189
#define TRUE
Definition: types.h:120
NOTEPAD_GLOBALS Globals
Definition: main.c:29
#define IDC_STATIC
Definition: calc.h:41
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
int32_t INT_PTR
Definition: typedefs.h:62
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
int OSK_DlgInitDialog(HWND hDlg)
Definition: main.c:109
#define IDC_LED_CAPS
Definition: osk_res.h:12
UINT msg
Definition: msvc.h:92
SHORT WINAPI GetKeyState(_In_ int)
#define BLACK_BRUSH
Definition: wingdi.h:894
BOOL OSK_DlgCommand(WPARAM wCommand, HWND hWndControl)
Definition: main.c:241
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_TIMER
Definition: winuser.h:1718
#define WM_CLOSE
Definition: winuser.h:1603
int OSK_DlgTimer(void)
Definition: main.c:216
#define IDC_LED_SCROLL
Definition: osk_res.h:13
#define WM_COMMAND
Definition: winuser.h:1716
#define VK_SCROLL
Definition: winuser.h:2234
#define VK_NUMLOCK
Definition: winuser.h:2233
#define VK_CAPITAL
Definition: winuser.h:2160
#define IDC_LED_NUM
Definition: osk_res.h:11
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139

◆ OSK_DlgTimer()

int OSK_DlgTimer ( void  )

Definition at line 216 of file main.c.

Referenced by OSK_DlgProc().

217 {
218  /* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
219  HWND hWndActiveWindow;
220 
221  hWndActiveWindow = GetForegroundWindow();
222  if (hWndActiveWindow != NULL && hWndActiveWindow != Globals.hMainWnd)
223  {
224  Globals.hActiveWnd = hWndActiveWindow;
225  }
226 
227  /* Always redraw leds because it can be changed by the real keyboard) */
231 
232  return TRUE;
233 }
#define TRUE
Definition: types.h:120
NOTEPAD_GLOBALS Globals
Definition: main.c:29
#define IDC_LED_CAPS
Definition: osk_res.h:12
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define IDC_LED_SCROLL
Definition: osk_res.h:13
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define IDC_LED_NUM
Definition: osk_res.h:11
HWND hMainWnd
Definition: main.h:60

◆ OSK_ReleaseKey()

BOOL OSK_ReleaseKey ( WORD  ScanCode)

Definition at line 328 of file main.c.

Referenced by OSK_DlgClose().

329 {
330  INPUT Input;
331  BOOL bExtendedKey;
332  LONG WindowStyle;
333  HWND hWndControl;
334 
335  /* Is it a 2-states key ? */
336  hWndControl = GetDlgItem(Globals.hMainWnd, ScanCode);
337  WindowStyle = GetWindowLong(hWndControl, GWL_STYLE);
338  if ((WindowStyle & BS_AUTOCHECKBOX) != BS_AUTOCHECKBOX) return FALSE;
339 
340  /* Is the key down ? */
341  if (SendMessage(hWndControl, BM_GETCHECK, 0, 0) != BST_CHECKED) return TRUE;
342 
343  /* Extended key ? */
344  if (ScanCode & 0x0200)
345  bExtendedKey = TRUE;
346  else
347  bExtendedKey = FALSE;
348  ScanCode &= 0xFF;
349 
350  /* Release the key */
351  Input.type = INPUT_KEYBOARD;
352  Input.ki.wVk = 0;
353  Input.ki.wScan = ScanCode;
354  Input.ki.time = GetTickCount();
356  Input.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
357  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
358  SendInput(1, &Input, sizeof(Input));
359 
360  return TRUE;
361 }
#define TRUE
Definition: types.h:120
NOTEPAD_GLOBALS Globals
Definition: main.c:29
ULONG ScanCode
Definition: api.c:39
#define KEYEVENTF_KEYUP
Definition: winuser.h:1092
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
Definition: arc.h:84
DWORD time
Definition: winable.h:50
#define INPUT_KEYBOARD
Definition: winable.h:10
long LONG
Definition: pedump.c:60
LPARAM WINAPI GetMessageExtraInfo(void)
Definition: message.c:1315
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BM_GETCHECK
Definition: winuser.h:1879
DWORD dwFlags
Definition: winable.h:49
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define GetWindowLong
Definition: winuser.h:5662
#define GWL_STYLE
Definition: winuser.h:846
DWORD type
Definition: winable.h:59
WORD wScan
Definition: winable.h:48
#define KEYEVENTF_EXTENDEDKEY
Definition: winuser.h:1091
#define BST_CHECKED
Definition: winuser.h:197
#define SendMessage
Definition: winuser.h:5709
ULONG_PTR dwExtraInfo
Definition: winable.h:51
HWND hMainWnd
Definition: main.h:60
WORD wVk
Definition: winable.h:47
UINT WINAPI SendInput(UINT, LPINPUT, int)
Definition: ntwrapper.h:344
KEYBDINPUT ki
Definition: winable.h:62

◆ OSK_SetImage()

int OSK_SetImage ( int  IdDlgItem,
int  IdResource 
)

Definition at line 37 of file main.c.

Referenced by OSK_DlgInitDialog().

38 {
39  HICON hIcon;
40  HWND hWndItem;
41 
42  hIcon = (HICON)LoadImage(Globals.hInstance, MAKEINTRESOURCE(IdResource),
43  IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
44  if (hIcon == NULL)
45  return FALSE;
46 
47  hWndItem = GetDlgItem(Globals.hMainWnd, IdDlgItem);
48  if (hWndItem == NULL)
49  {
50  DestroyIcon(hIcon);
51  return FALSE;
52  }
53 
54  SendMessage(hWndItem, BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);
55 
56  /* The system automatically deletes these resources when the process that created them terminates (MSDN) */
57 
58  return TRUE;
59 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
NOTEPAD_GLOBALS Globals
Definition: main.c:29
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define BM_SETIMAGE
Definition: winuser.h:1883
UINT_PTR WPARAM
Definition: windef.h:207
HINSTANCE hInstance
Definition: main.h:59
LONG_PTR LPARAM
Definition: windef.h:208
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HICON hIcon
Definition: msconfig.c:44
#define SendMessage
Definition: winuser.h:5709
#define LoadImage
Definition: winuser.h:5681
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
HWND hMainWnd
Definition: main.h:60

◆ OSK_WarningProc()

INT_PTR CALLBACK OSK_WarningProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 67 of file main.c.

Referenced by OSK_DlgInitDialog().

68 {
70 
71  switch (Msg)
72  {
73  case WM_INITDIALOG:
74  {
75  return TRUE;
76  }
77 
78  case WM_COMMAND:
79  {
80  switch (LOWORD(wParam))
81  {
83  {
84  Globals.bShowWarning = !IsDlgButtonChecked(hDlg, IDC_SHOWWARNINGCHECK);
85  return TRUE;
86  }
87 
88  case IDOK:
89  case IDCANCEL:
90  {
91  EndDialog(hDlg, LOWORD(wParam));
92  return TRUE;
93  }
94  }
95  break;
96  }
97  }
98 
99  return FALSE;
100 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
NOTEPAD_GLOBALS Globals
Definition: main.c:29
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define IDC_SHOWWARNINGCHECK
Definition: resource.h:25
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
struct @1571 Msg[]
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1716
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Variable Documentation

◆ Globals

OSK_GLOBALS Globals

Definition at line 16 of file main.c.