ReactOS  0.4.15-dev-3165-gdf6fff7
precomp.h File Reference
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
#include <debug.h>
#include <uxtheme.h>
#include <vsstyle.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "osk_res.h"
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  OSK_GLOBALS
 
struct  OSK_KEYLEDINDICATOR
 

Macros

#define countof(x)   (sizeof(x) / sizeof((x)[0]))
 
#define MAX_BUFF   256
 

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)
 
LRESULT APIENTRY OSK_ThemeHandler (HWND hDlg, NMCUSTOMDRAW *pNmDraw)
 
DWORD WINAPI OSK_WarningDlgThread (LPVOID lpParameter)
 
int WINAPI wWinMain (HINSTANCE, HINSTANCE, LPWSTR, int)
 
VOID OSK_RestoreDlgPlacement (HWND hDlg)
 
VOID OSK_RefreshLEDKeys (VOID)
 
INT_PTR CALLBACK OSK_WarningProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LONG LoadDataFromRegistry (IN LPCWSTR lpValueDataName, OUT PDWORD pdwValueData)
 
LONG SaveDataToRegistry (IN LPCWSTR lpValueDataName, IN DWORD dwValueData)
 
VOID LoadSettings (VOID)
 
VOID SaveSettings (VOID)
 

Variables

OSK_GLOBALS Globals
 

Macro Definition Documentation

◆ countof

#define countof (   x)    (sizeof(x) / sizeof((x)[0]))

Definition at line 88 of file precomp.h.

◆ MAX_BUFF

#define MAX_BUFF   256

Definition at line 89 of file precomp.h.

Function Documentation

◆ LoadDataFromRegistry()

LONG LoadDataFromRegistry ( IN LPCWSTR  lpValueDataName,
OUT PDWORD  pdwValueData 
)

Definition at line 14 of file settings.c.

16 {
17  HKEY hKey;
18  LONG lResult;
19  DWORD dwValue;
20  DWORD cbData = sizeof(dwValue);
21 
22  /* Initialize the pointer parameter to default */
23  *pdwValueData = 0;
24 
25  /* Open our application's key in order to load its configuration data */
27  L"Software\\Microsoft\\Osk",
28  0,
29  KEY_READ,
30  &hKey);
31 
32  if (lResult != ERROR_SUCCESS)
33  {
34  /* Bail out */
35  DPRINT("LoadDataFromRegistry(): Failed to open the application's key! (Error - %li)\n", lResult);
36  return lResult;
37  }
38 
39  /* Load the specific value based on the parameter caller, lpValueDataName */
40  lResult = RegQueryValueExW(hKey,
41  lpValueDataName,
42  0,
43  0,
44  (BYTE *)&dwValue,
45  &cbData);
46 
47  if (lResult != ERROR_SUCCESS)
48  {
49 
50  /* Bail out */
51  DPRINT("LoadDataFromRegistry(): Failed to load the following value - \"%S\". (Error - %li)\n", lpValueDataName, lResult);
53  return lResult;
54  }
55 
56  /* Is the buffer's size too small to query the required data? */
57  if (cbData != sizeof(dwValue))
58  {
59  /* It is therefore bail out */
60  DPRINT("LoadDataFromRegistry(): The buffer is too small to hold the data!\n");
62  return ERROR_MORE_DATA;
63  }
64 
65  *pdwValueData = dwValue;
67  return lResult;
68 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define ERROR_MORE_DATA
Definition: dderror.h:13
unsigned char BYTE
Definition: xxhash.c:193
FxAutoRegKey hKey
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define DPRINT
Definition: sndvol32.h:71

Referenced by LoadSettings().

◆ LoadSettings()

VOID LoadSettings ( VOID  )

Definition at line 53 of file settings.c.

54 {
55  HKEY hKey = NULL;
56  int iItemIndex = -1;
57 
59  {
60  TCHAR szBuffer[MAX_PATH];
61  DWORD dwAdvancedChecked;
62  DWORD type, size = sizeof(dwAdvancedChecked);
63  LSTATUS lstatus;
64 
65  /* Restore last selected font */
66  if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("Font"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
67  {
68  //Get combobox handle
70 
71  //Search for match and return index if match found
72  iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
73  if(iItemIndex != CB_ERR)
74  {
75  ComboBox_SetCurSel(hWnd, iItemIndex);
77  }
78  }
79 
80  /* Restore last selected character set */
81  if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("CodePage"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
82  {
83  //Get combobox handle
85 
86  iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
87  if(iItemIndex != CB_ERR)
88  {
89  ComboBox_SetCurSel(hWnd, iItemIndex);
90  }
91  }
92 
93  lstatus = RegQueryValueEx(hKey, _T("Advanced"), NULL, &type, (LPBYTE)&dwAdvancedChecked, &size);
94  if (lstatus == ERROR_SUCCESS && type == REG_DWORD && dwAdvancedChecked != FALSE)
95  {
97  }
98 
100  }
101  else
102  {
103  /* Default font seems to be Arial */
105 
106  iItemIndex = ComboBox_FindStringExact(hWnd, -1, _T("Arial"));
107  if(iItemIndex != CB_ERR)
108  {
109  ComboBox_SetCurSel(hWnd, iItemIndex);
111  }
112  }
113 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_CHECK_ADVANCED
Definition: resource.h:26
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
#define SendDlgItemMessage
Definition: winuser.h:5818
#define IDC_COMBO_CHARSET
Definition: resource.h:21
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:22
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
#define CB_ERR
Definition: winuser.h:2411
#define MF_CHECKED
Definition: winuser.h:132
char TCHAR
Definition: xmlstorage.h:189
#define BM_CLICK
Definition: winuser.h:1900
#define _T(x)
Definition: vfdio.h:22
GLsizeiptr size
Definition: glext.h:5919
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:41
#define IDC_FONTCOMBO
Definition: resource.h:12
VOID ChangeMapFont(HWND hDlg)
Definition: charmap.c:162
LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen)
Definition: settings.c:19
#define RegOpenKeyEx
Definition: winreg.h:520
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
HWND hCharmapDlg
Definition: charmap.c:22
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_DWORD
Definition: sdbapi.c:596

◆ OSK_DlgClose()

int OSK_DlgClose ( void  )

Definition at line 284 of file main.c.

285 {
287 
288  /* Release Ctrl, Shift, Alt keys */
289  OSK_ReleaseKey(SCAN_CODE_44); // Left shift
290  OSK_ReleaseKey(SCAN_CODE_57); // Right shift
291  OSK_ReleaseKey(SCAN_CODE_58); // Left ctrl
292  OSK_ReleaseKey(SCAN_CODE_60); // Left alt
293  OSK_ReleaseKey(SCAN_CODE_62); // Right alt
294  OSK_ReleaseKey(SCAN_CODE_64); // Right ctrl
295 
296  /* delete GDI objects */
297  if (Globals.hBrushGreenLed) DeleteObject(Globals.hBrushGreenLed);
298 
299  /* Save the application's settings on registry */
300  SaveSettings();
301 
302  return TRUE;
303 }
#define SCAN_CODE_60
Definition: osk_res.h:118
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define TRUE
Definition: types.h:120
#define SCAN_CODE_64
Definition: osk_res.h:121
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define SCAN_CODE_62
Definition: osk_res.h:120
void SaveSettings(void)
Definition: settings.c:115
#define SCAN_CODE_57
Definition: osk_res.h:116
#define SCAN_CODE_58
Definition: osk_res.h:117
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
BOOL OSK_ReleaseKey(WORD ScanCode)
Definition: main.c:469
#define SCAN_CODE_44
Definition: osk_res.h:104
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_DlgProc().

◆ OSK_DlgCommand()

BOOL OSK_DlgCommand ( WPARAM  wCommand,
HWND  hWndControl 
)

Definition at line 360 of file main.c.

361 {
362  WORD ScanCode;
363  INPUT Input;
364  BOOL bExtendedKey;
365  BOOL bKeyDown;
366  BOOL bKeyUp;
367  LONG WindowStyle;
368  INT i;
369 
370  /* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
371  if (Globals.hActiveWnd)
372  {
373  MSG msg;
374 
375  SetForegroundWindow(Globals.hActiveWnd);
376  while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
377  {
380  }
381  }
382 
383  /* KeyDown and/or KeyUp ? */
384  WindowStyle = GetWindowLongW(hWndControl, GWL_STYLE);
385  if ((WindowStyle & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX)
386  {
387  /* 2-states key like Shift, Alt, Ctrl, ... */
388  if (SendMessageW(hWndControl, BM_GETCHECK, 0, 0) == BST_CHECKED)
389  {
390  bKeyDown = TRUE;
391  bKeyUp = FALSE;
392  }
393  else
394  {
395  bKeyDown = FALSE;
396  bKeyUp = TRUE;
397  }
398  }
399  else
400  {
401  /* Other key */
402  bKeyDown = TRUE;
403  bKeyUp = TRUE;
404  }
405 
406  /* Get the key from dialog control key command */
407  ScanCode = wCommand;
408 
409  /*
410  The user could've pushed one of the key buttons of the dialog that
411  can trigger particular function toggling (Caps Lock, Num Lock or Scroll Lock). Update
412  (invalidate) the LED icon resources accordingly.
413  */
414  for (i = 0; i < _countof(LedKey); i++)
415  {
416  if (LedKey[i].wScanCode == ScanCode)
417  {
419  }
420  }
421 
422  /* Extended key ? */
423  if (ScanCode & 0x0200)
424  bExtendedKey = TRUE;
425  else
426  bExtendedKey = FALSE;
427  ScanCode &= 0xFF;
428 
429  /* Press and release the key */
430  if (bKeyDown)
431  {
432  Input.type = INPUT_KEYBOARD;
433  Input.ki.wVk = 0;
434  Input.ki.wScan = ScanCode;
435  Input.ki.time = GetTickCount();
436  Input.ki.dwExtraInfo = GetMessageExtraInfo();
437  Input.ki.dwFlags = KEYEVENTF_SCANCODE;
438  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
439  SendInput(1, &Input, sizeof(Input));
440  }
441 
442  if (bKeyUp)
443  {
444  Input.type = INPUT_KEYBOARD;
445  Input.ki.wVk = 0;
446  Input.ki.wScan = ScanCode;
447  Input.ki.time = GetTickCount();
448  Input.ki.dwExtraInfo = GetMessageExtraInfo();
449  Input.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
450  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
451  SendInput(1, &Input, sizeof(Input));
452  }
453 
454  /* Play the sound during clicking event (only if "Use Click Sound" menu option is ticked) */
455  if (Globals.bSoundClick)
456  {
458  }
459 
460  return TRUE;
461 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
NOTEPAD_GLOBALS Globals
Definition: main.c:31
ULONG ScanCode
Definition: api.c:39
#define KEYEVENTF_KEYUP
Definition: winuser.h:1092
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
Definition: arc.h:84
int32_t INT
Definition: typedefs.h:58
#define INPUT_KEYBOARD
Definition: winable.h:10
#define FALSE
Definition: types.h:117
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
LPARAM WINAPI GetMessageExtraInfo(void)
Definition: message.c:1340
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BM_GETCHECK
Definition: winuser.h:1901
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned short WORD
Definition: ntddk_ex.h:93
#define SND_ASYNC
Definition: mmsystem.h:154
#define SND_RESOURCE
Definition: mmsystem.h:163
#define GWL_STYLE
Definition: winuser.h:846
#define IDI_SOUNDCLICK
Definition: osk_res.h:11
#define GetModuleHandle
Definition: winbase.h:3683
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
OSK_KEYLEDINDICATOR LedKey[]
Definition: main.c:17
#define KEYEVENTF_EXTENDEDKEY
Definition: winuser.h:1091
#define BST_CHECKED
Definition: winuser.h:197
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182
HWND hMainWnd
Definition: main.h:56
UINT WINAPI SendInput(UINT, LPINPUT, int)
Definition: ntwrapper.h:344
BOOL WINAPI PlaySoundW(LPCWSTR pszSoundW, HMODULE hmod, DWORD fdwSound)
Definition: playsound.c:531

Referenced by OSK_DlgProc().

◆ OSK_DlgInitDialog()

int OSK_DlgInitDialog ( HWND  hDlg)

Definition at line 144 of file main.c.

145 {
147  HMONITOR monitor;
149  POINT Pt;
150  RECT rcWindow, rcDlgIntersect;
151 
152  /* Save handle */
153  Globals.hMainWnd = hDlg;
154 
155  /* Check the checked menu item before displaying the modal box */
156  if (Globals.bIsEnhancedKeyboard)
157  {
158  /* Enhanced keyboard dialog chosen, set the respective menu item as checked */
161  }
162  else
163  {
164  /* Standard keyboard dialog chosen, set the respective menu item as checked */
167  }
168 
169  /* Check if the "Click Sound" option was chosen before (and if so, then tick the menu item) */
170  if (Globals.bSoundClick)
171  {
173  }
174 
175  /* Set the application's icon */
178  if (hIcon || hIconSm)
179  {
180  /* Set the window icons (they are deleted when the process terminates) */
183  }
184 
185  /* Get screen info */
186  memset(&Pt, 0, sizeof(Pt));
187  monitor = MonitorFromPoint(Pt, MONITOR_DEFAULTTOPRIMARY);
188  info.cbSize = sizeof(info);
189  GetMonitorInfoW(monitor, &info);
190  GetWindowRect(hDlg, &rcWindow);
191 
192  /*
193  If the coordination values are default then re-initialize using the specific formulas
194  to move the dialog at the bottom of the screen.
195  */
196  if (Globals.PosX == CW_USEDEFAULT && Globals.PosY == CW_USEDEFAULT)
197  {
198  Globals.PosX = (info.rcMonitor.left + info.rcMonitor.right - (rcWindow.right - rcWindow.left)) / 2;
199  Globals.PosY = info.rcMonitor.bottom - (rcWindow.bottom - rcWindow.top);
200  }
201 
202  /*
203  Calculate the intersection of two rectangle sources (dialog and work desktop area).
204  If such sources do not intersect, then the dialog is deemed as "off screen".
205  */
206  if (IntersectRect(&rcDlgIntersect, &rcWindow, &info.rcWork) == 0)
207  {
208  Globals.PosX = (info.rcMonitor.left + info.rcMonitor.right - (rcWindow.right - rcWindow.left)) / 2;
209  Globals.PosY = info.rcMonitor.bottom - (rcWindow.bottom - rcWindow.top);
210  }
211  else
212  {
213  /*
214  There's still some intersection but we're not for sure if it is sufficient (the dialog could also be partially hidden).
215  Therefore, check the remaining intersection if it's enough.
216  */
217  if (rcWindow.top < info.rcWork.top || rcWindow.left < info.rcWork.left || rcWindow.right > info.rcWork.right || rcWindow.bottom > info.rcWork.bottom)
218  {
219  Globals.PosX = (info.rcMonitor.left + info.rcMonitor.right - (rcWindow.right - rcWindow.left)) / 2;
220  Globals.PosY = info.rcMonitor.bottom - (rcWindow.bottom - rcWindow.top);
221  }
222  }
223 
224  /*
225  Place the window (with respective placement coordinates) as topmost, above
226  every window which are not on top or are at the bottom of the Z order.
227  */
228  if (Globals.bAlwaysOnTop)
229  {
231  SetWindowPos(hDlg, HWND_TOPMOST, Globals.PosX, Globals.PosY, 0, 0, SWP_NOSIZE);
232  }
233  else
234  {
236  SetWindowPos(hDlg, HWND_NOTOPMOST, Globals.PosX, Globals.PosY, 0, 0, SWP_NOSIZE);
237  }
238 
239  /* Set icon on visual buttons */
256 
257  /* Create a green brush for leds */
258  Globals.hBrushGreenLed = CreateSolidBrush(RGB(0, 255, 0));
259 
260  /* Set a timer for periodics tasks */
261  Globals.iTimer = SetTimer(hDlg, 0, 50, NULL);
262 
263  return TRUE;
264 }
#define SCAN_CODE_30
Definition: osk_res.h:90
HMONITOR WINAPI MonitorFromPoint(POINT, DWORD)
static HICON
Definition: imagelist.c:84
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define MF_BYCOMMAND
Definition: winuser.h:202
#define RGB(r, g, b)
Definition: precomp.h:62
#define SCAN_CODE_128
Definition: osk_res.h:167
#define IDI_PG_UP
Definition: osk_res.h:27
#define TRUE
Definition: types.h:120
#define IDI_OSK
Definition: osk_res.h:18
LONG top
Definition: windef.h:307
#define IDI_RIGHT
Definition: osk_res.h:31
#define HWND_TOPMOST
Definition: winuser.h:1194
#define SM_CYSMICON
Definition: winuser.h:1003
#define SCAN_CODE_79
Definition: osk_res.h:124
#define IDI_TOP
Definition: osk_res.h:30
#define IDI_TAB
Definition: osk_res.h:20
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define IDI_SHIFT
Definition: osk_res.h:23
#define ICON_SMALL
Definition: tnclass.cpp:48
HINSTANCE hInstance
Definition: main.h:55
#define SCAN_CODE_80
Definition: osk_res.h:125
#define SCAN_CODE_16
Definition: osk_res.h:76
#define IDI_LEFT
Definition: osk_res.h:29
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
int OSK_SetImage(int IdDlgItem, int IdResource)
Definition: main.c:32
#define IDI_BACK
Definition: osk_res.h:19
#define SCAN_CODE_57
Definition: osk_res.h:116
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
#define IDI_MENU
Definition: osk_res.h:25
#define CW_USEDEFAULT
Definition: winuser.h:225
#define IDI_HOME
Definition: osk_res.h:26
#define SCAN_CODE_86
Definition: osk_res.h:130
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDM_ON_TOP
Definition: osk_res.h:43
#define IDI_CAPS_LOCK
Definition: osk_res.h:21
#define IDM_STANDARD_KB
Definition: osk_res.h:36
#define MF_CHECKED
Definition: winuser.h:132
#define IDM_ENHANCED_KB
Definition: osk_res.h:37
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
int WINAPI GetSystemMetrics(_In_ int)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SM_CXSMICON
Definition: winuser.h:1002
struct _test_info info[]
Definition: SetCursorPos.c:19
#define IDI_REACTOS
Definition: osk_res.h:24
#define SCAN_CODE_89
Definition: osk_res.h:131
#define MF_UNCHECKED
Definition: winuser.h:204
#define SCAN_CODE_15
Definition: osk_res.h:75
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define IDI_RETURN
Definition: osk_res.h:22
#define SWP_NOSIZE
Definition: winuser.h:1231
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1089
#define SCAN_CODE_127
Definition: osk_res.h:166
HICON hIcon
Definition: msconfig.c:44
#define SCAN_CODE_84
Definition: osk_res.h:128
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDI_BOTTOM
Definition: osk_res.h:32
#define SCAN_CODE_43
Definition: osk_res.h:103
#define NULL
Definition: types.h:112
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
HICON hIconSm
Definition: msconfig.c:44
LONG bottom
Definition: windef.h:309
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 HWND_NOTOPMOST
Definition: winuser.h:1192
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SCAN_CODE_85
Definition: osk_res.h:129
#define SCAN_CODE_44
Definition: osk_res.h:104
#define SCAN_CODE_83
Definition: osk_res.h:127
#define memset(x, y, z)
Definition: compat.h:39
HMENU WINAPI GetMenu(_In_ HWND)
HWND hMainWnd
Definition: main.h:56
#define IDI_PG_DOWN
Definition: osk_res.h:28
#define IDM_CLICK_SOUND
Definition: osk_res.h:44
#define ICON_BIG
Definition: tnclass.cpp:51
#define SCAN_CODE_129
Definition: osk_res.h:168

Referenced by OSK_DlgProc().

◆ OSK_DlgProc()

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

Definition at line 586 of file main.c.

587 {
588  switch (msg)
589  {
590  case WM_INITDIALOG:
591  OSK_DlgInitDialog(hDlg);
592  return TRUE;
593 
594  case WM_TIMER:
595  OSK_DlgTimer();
596  return TRUE;
597 
598  case WM_NOTIFY:
599  return OSK_ThemeHandler(hDlg, (LPNMCUSTOMDRAW)lParam);
600 
601  case WM_CTLCOLORSTATIC:
602  if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_NUM))
603  {
604  if (GetKeyState(VK_NUMLOCK) & 0x0001)
605  return (INT_PTR)Globals.hBrushGreenLed;
606  else
608  }
609  if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_CAPS))
610  {
611  if (GetKeyState(VK_CAPITAL) & 0x0001)
612  return (INT_PTR)Globals.hBrushGreenLed;
613  else
615  }
616  if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_SCROLL))
617  {
618  if (GetKeyState(VK_SCROLL) & 0x0001)
619  return (INT_PTR)Globals.hBrushGreenLed;
620  else
622  }
623  break;
624 
625  case WM_COMMAND:
626  switch (LOWORD(wParam))
627  {
628  case IDCANCEL:
629  {
630  EndDialog(hDlg, FALSE);
631  break;
632  }
633 
634  case IDM_EXIT:
635  {
636  EndDialog(hDlg, FALSE);
637  break;
638  }
639 
640  case IDM_ENHANCED_KB:
641  {
642  if (!Globals.bIsEnhancedKeyboard)
643  {
644  /*
645  The user attempted to switch to enhanced keyboard dialog type.
646  Set the member value as TRUE, destroy the dialog and save the data configuration into the registry.
647  */
648  Globals.bIsEnhancedKeyboard = TRUE;
649  EndDialog(hDlg, FALSE);
650  SaveSettings();
651 
652  /* Change the condition of enhanced keyboard item menu to checked */
655 
656  /*
657  Before creating the dialog box restore the coordinates. The user can
658  move the dialog around before choosing a different dialog layout therefore
659  we must create the dialog with the new coordinates.
660  */
662 
663  /* Finally, display the dialog modal box with the enhanced keyboard dialog */
667  OSK_DlgProc);
668  }
669 
670  break;
671  }
672 
673  case IDM_STANDARD_KB:
674  {
675  if (Globals.bIsEnhancedKeyboard)
676  {
677  /*
678  The user attempted to switch to standard keyboard dialog type.
679  Set the member value as FALSE, destroy the dialog and save the data configuration into the registry.
680  */
681  Globals.bIsEnhancedKeyboard = FALSE;
682  EndDialog(hDlg, FALSE);
683  SaveSettings();
684 
685  /* Change the condition of standard keyboard item menu to checked */
688 
689  /*
690  Before creating the dialog box restore the coordinates. The user can
691  move the dialog around before choosing a different dialog layout therefore
692  we must create the dialog with the new coordinates.
693  */
695 
696  /* Finally, display the dialog modal box with the standard keyboard dialog */
700  OSK_DlgProc);
701  }
702 
703  break;
704  }
705 
706  case IDM_CLICK_SOUND:
707  {
708  /*
709  This case is triggered when the user attempts to click on the menu item. Before doing anything,
710  we must check the condition state of such menu item so that we can tick/untick the menu item accordingly.
711  */
712  if (!Globals.bSoundClick)
713  {
714  Globals.bSoundClick = TRUE;
716  }
717  else
718  {
719  Globals.bSoundClick = FALSE;
721  }
722 
723  break;
724  }
725 
726  case IDM_ON_TOP:
727  {
728  /*
729  Check the condition state before disabling/enabling the menu
730  item and change the topmost order.
731  */
732  if (!Globals.bAlwaysOnTop)
733  {
734  Globals.bAlwaysOnTop = TRUE;
736  SetWindowPos(hDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
737  }
738  else
739  {
740  Globals.bAlwaysOnTop = FALSE;
742  SetWindowPos(hDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
743  }
744 
745  break;
746  }
747 
748  case IDM_ABOUT:
749  {
750  OSK_About();
751  break;
752  }
753 
754  default:
756  break;
757  }
758  break;
759 
760  case WM_THEMECHANGED:
761  /* Redraw the dialog (and its control buttons) using the new theme */
762  InvalidateRect(hDlg, NULL, FALSE);
763  break;
764 
765  case WM_CLOSE:
766  OSK_DlgClose();
767  break;
768  }
769 
770  return 0;
771 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
INT_PTR APIENTRY OSK_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:586
int OSK_DlgClose(void)
Definition: main.c:284
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define MF_BYCOMMAND
Definition: winuser.h:202
#define IDM_ABOUT
Definition: resource.h:29
#define TRUE
Definition: types.h:120
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1755
#define MAIN_DIALOG_STANDARD_KB
Definition: osk_res.h:9
#define HWND_TOPMOST
Definition: winuser.h:1194
int32_t INT_PTR
Definition: typedefs.h:64
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
HINSTANCE hInstance
Definition: main.h:55
int OSK_DlgInitDialog(HWND hDlg)
Definition: main.c:144
void SaveSettings(void)
Definition: settings.c:115
#define IDC_LED_CAPS
Definition: osk_res.h:14
#define FALSE
Definition: types.h:117
LRESULT APIENTRY OSK_ThemeHandler(HWND hDlg, NMCUSTOMDRAW *pNmDraw)
Definition: main.c:510
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define IDM_ON_TOP
Definition: osk_res.h:43
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4375
SHORT WINAPI GetKeyState(_In_ int)
#define BLACK_BRUSH
Definition: wingdi.h:895
#define IDM_STANDARD_KB
Definition: osk_res.h:36
#define MF_CHECKED
Definition: winuser.h:132
BOOL OSK_DlgCommand(WPARAM wCommand, HWND hWndControl)
Definition: main.c:360
#define IDM_ENHANCED_KB
Definition: osk_res.h:37
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_TIMER
Definition: winuser.h:1725
#define WM_CLOSE
Definition: winuser.h:1604
int OSK_DlgTimer(void)
Definition: main.c:334
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define IDC_LED_SCROLL
Definition: osk_res.h:15
#define WM_COMMAND
Definition: winuser.h:1723
#define MF_UNCHECKED
Definition: winuser.h:204
#define SWP_NOSIZE
Definition: winuser.h:1231
VOID OSK_About(VOID)
Definition: main.c:117
#define VK_SCROLL
Definition: winuser.h:2256
#define VK_NUMLOCK
Definition: winuser.h:2255
#define MAIN_DIALOG_ENHANCED_KB
Definition: osk_res.h:8
#define VK_CAPITAL
Definition: winuser.h:2182
#define NULL
Definition: types.h:112
#define IDM_EXIT
Definition: resource.h:27
#define msg(x)
Definition: auth_time.c:54
#define SWP_NOMOVE
Definition: winuser.h:1230
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define HWND_NOTOPMOST
Definition: winuser.h:1192
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDC_LED_NUM
Definition: osk_res.h:13
#define IDCANCEL
Definition: winuser.h:825
VOID OSK_RestoreDlgPlacement(HWND hDlg)
Definition: main.c:272
HMENU WINAPI GetMenu(_In_ HWND)
#define WM_INITDIALOG
Definition: winuser.h:1722
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
#define IDM_CLICK_SOUND
Definition: osk_res.h:44

Referenced by OSK_DlgProc(), and wWinMain().

◆ OSK_DlgTimer()

int OSK_DlgTimer ( void  )

Definition at line 334 of file main.c.

335 {
336  /* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
337  HWND hWndActiveWindow;
338 
339  hWndActiveWindow = GetForegroundWindow();
340  if (hWndActiveWindow != NULL && hWndActiveWindow != Globals.hMainWnd)
341  {
342  Globals.hActiveWnd = hWndActiveWindow;
343  }
344 
345  /*
346  Update the LED key indicators accordingly to their state (if one
347  of the specific keys is held down).
348  */
350 
351  return TRUE;
352 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define TRUE
Definition: types.h:120
VOID OSK_RefreshLEDKeys(VOID)
Definition: main.c:312
#define NULL
Definition: types.h:112
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_DlgProc().

◆ OSK_RefreshLEDKeys()

VOID OSK_RefreshLEDKeys ( VOID  )

Definition at line 312 of file main.c.

313 {
314  INT i;
315  BOOL bKeyIsPressed;
316 
317  for (i = 0; i < _countof(LedKey); i++)
318  {
319  bKeyIsPressed = (GetAsyncKeyState(LedKey[i].vKey) & 0x8000) != 0;
320  if (LedKey[i].bWasKeyPressed != bKeyIsPressed)
321  {
322  LedKey[i].bWasKeyPressed = bKeyIsPressed;
324  }
325  }
326 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
SHORT WINAPI GetAsyncKeyState(_In_ int)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
OSK_KEYLEDINDICATOR LedKey[]
Definition: main.c:17
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_DlgTimer().

◆ OSK_ReleaseKey()

BOOL OSK_ReleaseKey ( WORD  ScanCode)

Definition at line 469 of file main.c.

470 {
471  INPUT Input;
472  BOOL bExtendedKey;
473  LONG WindowStyle;
474  HWND hWndControl;
475 
476  /* Is it a 2-states key ? */
477  hWndControl = GetDlgItem(Globals.hMainWnd, ScanCode);
478  WindowStyle = GetWindowLongW(hWndControl, GWL_STYLE);
479  if ((WindowStyle & BS_AUTOCHECKBOX) != BS_AUTOCHECKBOX) return FALSE;
480 
481  /* Is the key down ? */
482  if (SendMessageW(hWndControl, BM_GETCHECK, 0, 0) != BST_CHECKED) return TRUE;
483 
484  /* Extended key ? */
485  if (ScanCode & 0x0200)
486  bExtendedKey = TRUE;
487  else
488  bExtendedKey = FALSE;
489  ScanCode &= 0xFF;
490 
491  /* Release the key */
492  Input.type = INPUT_KEYBOARD;
493  Input.ki.wVk = 0;
494  Input.ki.wScan = ScanCode;
495  Input.ki.time = GetTickCount();
496  Input.ki.dwExtraInfo = GetMessageExtraInfo();
497  Input.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
498  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
499  SendInput(1, &Input, sizeof(Input));
500 
501  return TRUE;
502 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
ULONG ScanCode
Definition: api.c:39
#define KEYEVENTF_KEYUP
Definition: winuser.h:1092
#define TRUE
Definition: types.h:120
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
Definition: arc.h:84
#define INPUT_KEYBOARD
Definition: winable.h:10
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
LPARAM WINAPI GetMessageExtraInfo(void)
Definition: message.c:1340
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BM_GETCHECK
Definition: winuser.h:1901
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define GWL_STYLE
Definition: winuser.h:846
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define KEYEVENTF_EXTENDEDKEY
Definition: winuser.h:1091
#define BST_CHECKED
Definition: winuser.h:197
HWND hMainWnd
Definition: main.h:56
UINT WINAPI SendInput(UINT, LPINPUT, int)
Definition: ntwrapper.h:344

Referenced by OSK_DlgClose().

◆ OSK_RestoreDlgPlacement()

VOID OSK_RestoreDlgPlacement ( HWND  hDlg)

Definition at line 272 of file main.c.

273 {
274  LoadSettings();
275  SetWindowPos(hDlg, (Globals.bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST), Globals.PosX, Globals.PosY, 0, 0, SWP_NOSIZE);
276 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define HWND_TOPMOST
Definition: winuser.h:1194
void LoadSettings(void)
Definition: settings.c:53
#define SWP_NOSIZE
Definition: winuser.h:1231
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define HWND_NOTOPMOST
Definition: winuser.h:1192

Referenced by OSK_DlgProc().

◆ OSK_SetImage()

int OSK_SetImage ( int  IdDlgItem,
int  IdResource 
)

Definition at line 32 of file main.c.

33 {
34  HICON hIcon;
35  HWND hWndItem;
36 
38  IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
39  if (hIcon == NULL)
40  return FALSE;
41 
42  hWndItem = GetDlgItem(Globals.hMainWnd, IdDlgItem);
43  if (hWndItem == NULL)
44  {
46  return FALSE;
47  }
48 
50 
51  /* The system automatically deletes these resources when the process that created them terminates (MSDN) */
52 
53  return TRUE;
54 }
static HICON
Definition: imagelist.c:84
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
UINT_PTR WPARAM
Definition: windef.h:207
#define BM_SETIMAGE
Definition: winuser.h:1905
HINSTANCE hInstance
Definition: main.h:55
#define FALSE
Definition: types.h:117
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
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_DlgInitDialog().

◆ OSK_ThemeHandler()

LRESULT APIENTRY OSK_ThemeHandler ( HWND  hDlg,
NMCUSTOMDRAW pNmDraw 
)

Definition at line 510 of file main.c.

511 {
512  HTHEME hTheme;
513  HWND hDlgButtonCtrl;
514  LRESULT Ret;
515  INT iState = PBS_NORMAL;
516 
517  /* Retrieve the theme handle for the button controls */
518  hDlgButtonCtrl = pNmDraw->hdr.hwndFrom;
519  hTheme = GetWindowTheme(hDlgButtonCtrl);
520 
521  /*
522  Begin the painting procedures if we retrieved
523  the theme for control buttons of the dialog.
524  */
525  if (hTheme)
526  {
527  /* Obtain CDDS drawing stages */
528  switch (pNmDraw->dwDrawStage)
529  {
530  case CDDS_PREPAINT:
531  {
532  /*
533  The button could be either in normal state or pushed.
534  Retrieve its state and save to a variable.
535  */
536  if (pNmDraw->uItemState & CDIS_DEFAULT)
537  {
538  iState = PBS_DEFAULTED;
539  }
540  else if (pNmDraw->uItemState & CDIS_SELECTED)
541  {
542  iState = PBS_PRESSED;
543  }
544  else if (pNmDraw->uItemState & CDIS_HOT)
545  {
546  iState = PBS_HOT;
547  }
548 
550  {
551  /* Draw the application if the theme is transparent */
552  DrawThemeParentBackground(hDlgButtonCtrl, pNmDraw->hdc, &pNmDraw->rc);
553  }
554 
555  /* Draw it */
556  DrawThemeBackground(hTheme, pNmDraw->hdc, BP_PUSHBUTTON, iState, &pNmDraw->rc, NULL);
557 
558  Ret = CDRF_SKIPDEFAULT;
559  break;
560  }
561 
562  case CDDS_PREERASE:
563  {
564  Ret = CDRF_DODEFAULT;
565  break;
566  }
567 
568  default:
569  Ret = CDRF_SKIPDEFAULT;
570  break;
571  }
572  }
573  else
574  {
575  /* hTheme is NULL so bail right away */
576  Ret = CDRF_DODEFAULT;
577  }
578 
579  return Ret;
580 }
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: draw.c:1883
#define CDIS_SELECTED
Definition: commctrl.h:291
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
#define CDIS_HOT
Definition: commctrl.h:297
#define CDRF_DODEFAULT
Definition: commctrl.h:268
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
#define CDDS_PREPAINT
Definition: commctrl.h:280
HWND hwndFrom
Definition: winuser.h:3133
#define NULL
Definition: types.h:112
LONG_PTR LRESULT
Definition: windef.h:209
#define CDIS_DEFAULT
Definition: commctrl.h:296
#define CDDS_PREERASE
Definition: commctrl.h:282

Referenced by OSK_DlgProc().

◆ OSK_WarningDlgThread()

DWORD WINAPI OSK_WarningDlgThread ( LPVOID  lpParameter)

Definition at line 103 of file main.c.

104 {
106 
108  return 0;
109 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4375
HINSTANCE hInstance
Definition: main.c:36
HANDLE HINSTANCE
Definition: typedefs.h:77
LPVOID lpParameter
Definition: kernel32.h:241
INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:62
#define IDD_WARNINGDIALOG_OSK
Definition: osk_res.h:50
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HWND hMainWnd
Definition: main.h:56

Referenced by wWinMain().

◆ OSK_WarningProc()

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

Definition at line 62 of file main.c.

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

Referenced by OSK_WarningDlgThread(), and wWinMain().

◆ SaveDataToRegistry()

LONG SaveDataToRegistry ( IN LPCWSTR  lpValueDataName,
IN DWORD  dwValueData 
)

Definition at line 70 of file settings.c.

72 {
73  HKEY hKey;
74  LONG lResult;
75 
76  /* Set up the application's key in case it has not been made yet */
78  L"Software\\Microsoft\\Osk",
79  0,
80  NULL,
81  0,
82  KEY_WRITE,
83  NULL,
84  &hKey,
85  NULL);
86 
87  if (lResult != ERROR_SUCCESS)
88  {
89  /* Bail out */
90  DPRINT("SaveDataToRegistry(): Failed to create the application's key! (Error - %li)\n", lResult);
91  return lResult;
92  }
93 
94  /* Save the data into the registry value */
95  lResult = RegSetValueExW(hKey,
96  lpValueDataName,
97  0,
98  REG_DWORD,
99  (BYTE *)&dwValueData,
100  sizeof(dwValueData));
101 
102  if (lResult != ERROR_SUCCESS)
103  {
104  /* Bail out */
105  DPRINT("SaveDataToRegistry(): Failed to save the following value - \"%S\". (Error - %li)\n", lpValueDataName, lResult);
106  RegCloseKey(hKey);
107  return lResult;
108  }
109 
110  RegCloseKey(hKey);
111  return lResult;
112 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: xxhash.c:193
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
#define DPRINT
Definition: sndvol32.h:71
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by SaveSettings().

◆ SaveSettings()

VOID SaveSettings ( VOID  )

Definition at line 115 of file settings.c.

116 {
117  HKEY hKey = NULL;
118 
120  {
121  TCHAR szBuffer[MAX_PATH];
122 
124  ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
125 
126  if(*szBuffer != '\0')
127  RegSetValueEx(hKey, _T("Font"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
128 
130  ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
131 
132  if(*szBuffer != '\0')
133  RegSetValueEx(hKey, _T("CodePage"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
134 
135  RegSetValueEx(hKey, _T("Advanced"), 0, REG_DWORD, (LPBYTE)&Settings.IsAdvancedView, (DWORD) sizeof(DWORD));
136 
137  RegCloseKey(hKey);
138  }
139 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
#define ComboBox_GetText(hwndCtl, lpch, cchMax)
Definition: windowsx.h:33
#define IDC_COMBO_CHARSET
Definition: resource.h:21
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2592
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_FONTCOMBO
Definition: resource.h:12
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
HWND hCharmapDlg
Definition: charmap.c:22
#define REG_DWORD
Definition: sdbapi.c:596
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define REG_SZ
Definition: layer.c:22

◆ wWinMain()

int WINAPI wWinMain ( HINSTANCE  ,
HINSTANCE  ,
LPWSTR  ,
int   
)

Definition at line 670 of file charmap.c.

674 {
676  INT Ret = 1;
677  HMODULE hRichEd20;
678  MSG Msg;
679 
680  hInstance = hInst;
681 
682  /* Mirroring code for the titlebar */
683  switch (GetUserDefaultUILanguage())
684  {
687  break;
688 
689  default:
690  break;
691  }
692 
693  iccx.dwSize = sizeof(INITCOMMONCONTROLSEX);
694  iccx.dwICC = ICC_TAB_CLASSES;
695  InitCommonControlsEx(&iccx);
696 
698  {
699  hRichEd20 = LoadLibraryW(L"RICHED20.DLL");
700 
701  if (hRichEd20 != NULL)
702  {
704 
705  for (;;)
706  {
707  if (GetMessage(&Msg, NULL, 0, 0) <= 0)
708  {
709  Ret = Msg.wParam;
710  break;
711  }
712 
715  }
716 
717  FreeLibrary(hRichEd20);
718  }
720  }
721 
722  return Ret;
723 }
#define DispatchMessage
Definition: winuser.h:5741
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:806
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define LAYOUT_RTL
Definition: wingdi.h:1370
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define SUBLANG_DEFAULT
Definition: nls.h:168
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
int32_t INT
Definition: typedefs.h:58
#define LANG_HEBREW
Definition: nls.h:67
static HWND InitInstance(HINSTANCE hInst)
Definition: charmap.c:607
HINSTANCE hInstance
Definition: charmap.c:20
VOID UnregisterMapClasses(HINSTANCE hInstance)
Definition: map.c:741
#define LoadLibraryW(x)
Definition: compat.h:606
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1720
#define FreeLibrary(x)
Definition: compat.h:607
struct @1586 Msg[]
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
BOOL RegisterMapClasses(HINSTANCE hInstance)
Definition: map.c:715
HINSTANCE hInst
Definition: dxdiag.c:13
#define NULL
Definition: types.h:112
#define GetMessage
Definition: winuser.h:5766
#define MAKELANGID(p, s)
Definition: nls.h:15
#define ICC_TAB_CLASSES
Definition: commctrl.h:61

Variable Documentation

◆ Globals

OSK_GLOBALS Globals

Definition at line 13 of file clipbrd.c.