ReactOS  0.4.15-dev-4857-g47842d7
main.c File Reference
#include "precomp.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

int OSK_SetImage (int IdDlgItem, int IdResource)
 
void OSK_SetText (int IdDlgItem, int IdResource)
 
INT_PTR CALLBACK OSK_WarningProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
DWORD WINAPI OSK_WarningDlgThread (LPVOID lpParameter)
 
VOID OSK_About (VOID)
 
VOID OSK_DestroyKeys (VOID)
 
LRESULT OSK_SetKeys (int reason)
 
LRESULT OSK_Create (HWND hwnd)
 
int OSK_Close (void)
 
VOID OSK_RefreshLEDKeys (VOID)
 
int OSK_Timer (void)
 
VOID OSK_ChooseFont (VOID)
 
BOOL OSK_Command (WPARAM wCommand, HWND hWndControl)
 
BOOL OSK_ReleaseKey (WORD ScanCode)
 
LRESULT OSK_Paint (HWND hwnd)
 
LRESULT APIENTRY OSK_WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int show)
 

Variables

OSK_GLOBALS Globals
 
OSK_KEYLEDINDICATOR LedKey []
 

Function Documentation

◆ OSK_About()

VOID OSK_About ( VOID  )

Definition at line 138 of file main.c.

139 {
140  WCHAR szAuthors[MAX_PATH];
141  HICON OSKIcon;
142 
143  /* Load the icon */
145 
146  /* Load the strings into the "About" dialog */
147  LoadStringW(Globals.hInstance, IDS_AUTHORS, szAuthors, _countof(szAuthors));
148 
149  /* Finally, execute the "About" dialog by using the Shell routine */
150  ShellAboutW(Globals.hMainWnd, Globals.szTitle, szAuthors, OSKIcon);
151 
152  /* Once done, destroy the icon */
153  DestroyIcon(OSKIcon);
154 }
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 IDS_AUTHORS
Definition: osk_res.h:50
#define IDI_OSK
Definition: osk_res.h:15
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE hInstance
Definition: main.h:55
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define LR_DEFAULTSIZE
Definition: winuser.h:1088
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_WndProc().

◆ OSK_ChooseFont()

VOID OSK_ChooseFont ( VOID  )

Definition at line 580 of file main.c.

581 {
582  LOGFONTW lf = {0};
583  CHOOSEFONTW cf = {0};
584  HFONT hFont, hOldFont;
585  int i;
586 
587  StringCchCopyW(lf.lfFaceName, _countof(Globals.FontFaceName), Globals.FontFaceName);
588  lf.lfHeight = Globals.FontHeight;
589 
590  cf.lStructSize = sizeof(cf);
591  cf.hwndOwner = Globals.hMainWnd;
592  cf.lpLogFont = &lf;
594 
595  if (!ChooseFontW(&cf))
596  return;
597 
598  hFont = CreateFontIndirectW(&lf);
599 
600  if (!hFont)
601  return;
602 
603  /* Set font information */
604  StringCchCopyW(Globals.FontFaceName, _countof(Globals.FontFaceName), lf.lfFaceName);
605  Globals.FontHeight = lf.lfHeight;
606 
607  hOldFont = Globals.hFont;
608  Globals.hFont = hFont;
609 
610  for (i = 0; i < Globals.Keyboard->KeyCount; i++)
612 
613  DeleteObject(hOldFont);
614 }
static IClassFactory * cf
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define TRUE
Definition: types.h:120
LONG lfHeight
Definition: dimm.idl:59
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
Definition: fontdlg.c:184
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
HFONT hFont
Definition: main.h:60
#define _countof(array)
Definition: sndvol32.h:68
#define CF_NOSTYLESEL
Definition: commdlg.h:82
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 WM_SETFONT
Definition: winuser.h:1637
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
HWND hMainWnd
Definition: main.h:56
#define CF_INITTOLOGFONTSTRUCT
Definition: commdlg.h:66
HFONT hFont
Definition: main.c:53

Referenced by OSK_WndProc().

◆ OSK_Close()

int OSK_Close ( void  )

Definition at line 490 of file main.c.

491 {
493 
494  /* Release Ctrl, Shift, Alt keys */
495  OSK_ReleaseKey(SCAN_CODE_44); // Left shift
496  OSK_ReleaseKey(SCAN_CODE_57); // Right shift
497  OSK_ReleaseKey(SCAN_CODE_58); // Left ctrl
498  OSK_ReleaseKey(SCAN_CODE_60); // Left alt
499  OSK_ReleaseKey(SCAN_CODE_62); // Right alt
500  OSK_ReleaseKey(SCAN_CODE_64); // Right ctrl
501 
502  /* Destroy child controls */
503  OSK_DestroyKeys();
504 
505  /* delete GDI objects */
506  if (Globals.hBrushGreenLed) DeleteObject(Globals.hBrushGreenLed);
508 
509  /* Save the application's settings on registry */
510  SaveSettings();
511 
512  return TRUE;
513 }
#define SCAN_CODE_60
Definition: osk_res.h:131
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define TRUE
Definition: types.h:120
#define SCAN_CODE_64
Definition: osk_res.h:134
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define SCAN_CODE_62
Definition: osk_res.h:133
void SaveSettings(void)
Definition: settings.c:115
#define SCAN_CODE_57
Definition: osk_res.h:129
#define SCAN_CODE_58
Definition: osk_res.h:130
HFONT hFont
Definition: main.h:60
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
VOID OSK_DestroyKeys(VOID)
Definition: main.c:162
BOOL OSK_ReleaseKey(WORD ScanCode)
Definition: main.c:731
#define SCAN_CODE_44
Definition: osk_res.h:117
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_WndProc().

◆ OSK_Command()

BOOL OSK_Command ( WPARAM  wCommand,
HWND  hWndControl 
)

Definition at line 622 of file main.c.

623 {
624  WORD ScanCode;
625  INPUT Input;
626  BOOL bExtendedKey;
627  BOOL bKeyDown;
628  BOOL bKeyUp;
629  LONG WindowStyle;
630  INT i;
631 
632  /* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
633  if (Globals.hActiveWnd)
634  {
635  MSG msg;
636 
637  SetForegroundWindow(Globals.hActiveWnd);
638  while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
639  {
642  }
643  }
644 
645  /* KeyDown and/or KeyUp ? */
646  WindowStyle = GetWindowLongW(hWndControl, GWL_STYLE);
647  if ((WindowStyle & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX)
648  {
649  /* 2-states key like Shift, Alt, Ctrl, ... */
650  if (SendMessageW(hWndControl, BM_GETCHECK, 0, 0) == BST_CHECKED)
651  {
652  bKeyDown = TRUE;
653  bKeyUp = FALSE;
654  }
655  else
656  {
657  bKeyDown = FALSE;
658  bKeyUp = TRUE;
659  }
660  }
661  else
662  {
663  /* Other key */
664  bKeyDown = TRUE;
665  bKeyUp = TRUE;
666  }
667 
668  /* Get the key from dialog control key command */
669  ScanCode = wCommand;
670 
671  /*
672  The user could've pushed one of the key buttons of the dialog that
673  can trigger particular function toggling (Caps Lock, Num Lock or Scroll Lock). Update
674  (invalidate) the LED icon resources accordingly.
675  */
676  for (i = 0; i < _countof(LedKey); i++)
677  {
678  if (LedKey[i].wScanCode == ScanCode)
679  {
681  }
682  }
683 
684  /* Extended key ? */
685  if (ScanCode & 0x0200)
686  bExtendedKey = TRUE;
687  else
688  bExtendedKey = FALSE;
690 
691  /* Press and release the key */
692  if (bKeyDown)
693  {
694  Input.type = INPUT_KEYBOARD;
695  Input.ki.wVk = 0;
696  Input.ki.wScan = ScanCode;
697  Input.ki.time = GetTickCount();
698  Input.ki.dwExtraInfo = GetMessageExtraInfo();
699  Input.ki.dwFlags = KEYEVENTF_SCANCODE;
700  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
701  SendInput(1, &Input, sizeof(Input));
702  }
703 
704  if (bKeyUp)
705  {
706  Input.type = INPUT_KEYBOARD;
707  Input.ki.wVk = 0;
708  Input.ki.wScan = ScanCode;
709  Input.ki.time = GetTickCount();
710  Input.ki.dwExtraInfo = GetMessageExtraInfo();
711  Input.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
712  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
713  SendInput(1, &Input, sizeof(Input));
714  }
715 
716  /* Play the sound during clicking event (only if "Use Click Sound" menu option is ticked) */
717  if (Globals.bSoundClick)
718  {
720  }
721 
722  return TRUE;
723 }
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:1096
#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:1905
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:8
#define GetModuleHandle
Definition: winbase.h:3688
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:18
#define KEYEVENTF_EXTENDEDKEY
Definition: winuser.h:1095
#define BST_CHECKED
Definition: winuser.h:197
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define SCANCODE_MASK
Definition: precomp.h:122
#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:1186
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_WndProc().

◆ OSK_Create()

LRESULT OSK_Create ( HWND  hwnd)

Definition at line 372 of file main.c.

373 {
374  HMONITOR monitor;
376  POINT Pt;
377  RECT rcWindow, rcDlgIntersect;
378  LOGFONTW lf = {0};
379 
380  /* Save handle */
382 
383  /* Init Font */
384  lf.lfHeight = Globals.FontHeight;
385  StringCchCopyW(lf.lfFaceName, _countof(Globals.FontFaceName), Globals.FontFaceName);
387 
388  if (OSK_SetKeys(SETKEYS_INIT) == -1)
389  return -1;
390 
391  /* Check the checked menu item before displaying the window */
392  if (Globals.bIsEnhancedKeyboard)
393  {
394  /* Enhanced keyboard dialog chosen, set the respective menu item as checked */
397  }
398  else
399  {
400  /* Standard keyboard dialog chosen, set the respective menu item as checked */
403  }
404 
405  /* Check if the "Click Sound" option was chosen before (and if so, then tick the menu item) */
406  if (Globals.bSoundClick)
407  {
409  }
410 
411  /* Get screen info */
412  memset(&Pt, 0, sizeof(Pt));
413  monitor = MonitorFromPoint(Pt, MONITOR_DEFAULTTOPRIMARY);
414  info.cbSize = sizeof(info);
415  GetMonitorInfoW(monitor, &info);
416  GetWindowRect(hwnd, &rcWindow);
417 
418  /*
419  If the coordination values are default then re-initialize using the specific formulas
420  to move the dialog at the bottom of the screen.
421  */
422  if (Globals.PosX == CW_USEDEFAULT && Globals.PosY == CW_USEDEFAULT)
423  {
424  Globals.PosX = (info.rcMonitor.left + info.rcMonitor.right - (rcWindow.right - rcWindow.left)) / 2;
425  Globals.PosY = info.rcMonitor.bottom - (rcWindow.bottom - rcWindow.top);
426  }
427 
428  /*
429  Calculate the intersection of two rectangle sources (dialog and work desktop area).
430  If such sources do not intersect, then the dialog is deemed as "off screen".
431  */
432  if (IntersectRect(&rcDlgIntersect, &rcWindow, &info.rcWork) == 0)
433  {
434  Globals.PosX = (info.rcMonitor.left + info.rcMonitor.right - (rcWindow.right - rcWindow.left)) / 2;
435  Globals.PosY = info.rcMonitor.bottom - (rcWindow.bottom - rcWindow.top);
436  }
437  else
438  {
439  /*
440  There's still some intersection but we're not for sure if it is sufficient (the dialog could also be partially hidden).
441  Therefore, check the remaining intersection if it's enough.
442  */
443  if (rcWindow.top < info.rcWork.top || rcWindow.left < info.rcWork.left || rcWindow.right > info.rcWork.right || rcWindow.bottom > info.rcWork.bottom)
444  {
445  Globals.PosX = (info.rcMonitor.left + info.rcMonitor.right - (rcWindow.right - rcWindow.left)) / 2;
446  Globals.PosY = info.rcMonitor.bottom - (rcWindow.bottom - rcWindow.top);
447  }
448  }
449 
450  /*
451  Place the window (with respective placement coordinates) as topmost, above
452  every window which are not on top or are at the bottom of the Z order.
453  */
454  if (Globals.bAlwaysOnTop)
455  {
458  }
459  else
460  {
463  }
464 
465  /* Create a green brush for leds */
466  Globals.hBrushGreenLed = CreateSolidBrush(RGB(0, 255, 0));
467 
468  /* Set a timer for periodic tasks */
469  Globals.iTimer = SetTimer(hwnd, 0, 100, NULL);
470 
471  /* If the member of the struct (bShowWarning) is set then display the dialog box */
472  if (Globals.bShowWarning)
473  {
474  /* If for whatever reason the thread fails to be created then handle the dialog box in main thread... */
476  {
478  }
479  }
480 
481  return 0;
482 }
HMONITOR WINAPI MonitorFromPoint(POINT, DWORD)
NOTEPAD_GLOBALS Globals
Definition: main.c:31
DWORD WINAPI OSK_WarningDlgThread(LPVOID lpParameter)
Definition: main.c:124
#define MF_BYCOMMAND
Definition: winuser.h:202
#define RGB(r, g, b)
Definition: precomp.h:62
LONG lfHeight
Definition: dimm.idl:59
LONG top
Definition: windef.h:307
#define HWND_TOPMOST
Definition: winuser.h:1198
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
HINSTANCE hInstance
Definition: main.h:55
static struct _test_info info[]
Definition: SetCursorPos.c:19
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define CW_USEDEFAULT
Definition: winuser.h:225
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
HFONT hFont
Definition: main.h:60
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDM_ON_TOP
Definition: osk_res.h:40
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4379
#define IDM_STANDARD_KB
Definition: osk_res.h:33
#define MF_CHECKED
Definition: winuser.h:132
#define IDM_ENHANCED_KB
Definition: osk_res.h:34
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define _countof(array)
Definition: sndvol32.h:68
LRESULT OSK_SetKeys(int reason)
Definition: main.c:188
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:83
#define MF_UNCHECKED
Definition: winuser.h:204
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define SWP_NOSIZE
Definition: winuser.h:1235
#define NULL
Definition: types.h:112
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define IDD_WARNINGDIALOG_OSK
Definition: osk_res.h:47
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
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:1196
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define memset(x, y, z)
Definition: compat.h:39
HMENU WINAPI GetMenu(_In_ HWND)
HWND hMainWnd
Definition: main.h:56
#define IDM_CLICK_SOUND
Definition: osk_res.h:41

Referenced by OSK_WndProc().

◆ OSK_DestroyKeys()

VOID OSK_DestroyKeys ( VOID  )

Definition at line 162 of file main.c.

163 {
164  int i;
165  /* Hide before destroying child controls */
167 
168  for (i = 0; i < Globals.Keyboard->KeyCount; i++)
169  {
170  DestroyWindow(Globals.hKeys[i]);
171  }
172  for (i = 0; i < _countof(LedKey); i++)
173  {
175  }
176 
177  HeapFree(GetProcessHeap(), 0, Globals.hKeys);
178  Globals.hKeys = NULL;
179  Globals.Keyboard = NULL;
180 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define GetProcessHeap()
Definition: compat.h:595
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
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:18
HWND hMainWnd
Definition: main.h:56
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by OSK_Close(), and OSK_SetKeys().

◆ OSK_Paint()

LRESULT OSK_Paint ( HWND  hwnd)

Definition at line 772 of file main.c.

773 {
774  PAINTSTRUCT ps;
775  RECT rcText;
776  HFONT hOldFont = NULL;
777  WCHAR szTemp[MAX_PATH];
778 
779  HDC hdc = BeginPaint(hwnd, &ps);
780 
781  if (Globals.hFont)
782  hOldFont = SelectObject(hdc, Globals.hFont);
783 
784  rcText.left = Globals.Keyboard->LedTextStart.x;
785  rcText.top = Globals.Keyboard->LedTextStart.y;
786  rcText.right = rcText.left + Globals.Keyboard->LedTextSize.cx;
787  rcText.bottom = rcText.top + Globals.Keyboard->LedTextSize.cy;
788 
789  LoadStringW(Globals.hInstance, IDS_NUMLOCK, szTemp, _countof(szTemp));
790  DrawTextW(hdc, szTemp, -1, &rcText, DT_NOCLIP);
791 
792  OffsetRect(&rcText, Globals.Keyboard->LedTextOffset, 0);
793 
795  DrawTextW(hdc, szTemp, -1, &rcText, DT_NOCLIP);
796 
797  OffsetRect(&rcText, Globals.Keyboard->LedTextOffset, 0);
798 
800  DrawTextW(hdc, szTemp, -1, &rcText, DT_NOCLIP);
801 
802  if (hOldFont)
803  SelectObject(hdc, hOldFont);
804 
805  EndPaint(hwnd, &ps);
806 
807  return 0;
808 }
#define IDS_SCROLLLOCK
Definition: osk_res.h:54
#define IDS_CAPSLOCK
Definition: osk_res.h:53
NOTEPAD_GLOBALS Globals
Definition: main.c:31
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
LONG left
Definition: windef.h:306
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:308
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE hInstance
Definition: main.h:55
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
HFONT hFont
Definition: main.h:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
HDC hdc
Definition: main.c:9
#define DT_NOCLIP
Definition: winuser.h:536
#define IDS_NUMLOCK
Definition: osk_res.h:52
#define NULL
Definition: types.h:112
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:309
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by OSK_WndProc().

◆ OSK_RefreshLEDKeys()

VOID OSK_RefreshLEDKeys ( VOID  )

Definition at line 522 of file main.c.

523 {
524  INT i;
525  BOOL bKeyIsPressed;
526 
527  for (i = 0; i < _countof(LedKey); i++)
528  {
529  bKeyIsPressed = (GetAsyncKeyState(LedKey[i].vKey) & 0x8000) != 0;
530  if (LedKey[i].bWasKeyPressed != bKeyIsPressed)
531  {
532  LedKey[i].bWasKeyPressed = bKeyIsPressed;
534  }
535  }
536 }
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:18
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_Timer().

◆ OSK_ReleaseKey()

BOOL OSK_ReleaseKey ( WORD  ScanCode)

Definition at line 731 of file main.c.

732 {
733  INPUT Input;
734  BOOL bExtendedKey;
735  LONG WindowStyle;
736  HWND hWndControl;
737 
738  /* Is it a 2-states key ? */
739  hWndControl = GetDlgItem(Globals.hMainWnd, ScanCode);
740  WindowStyle = GetWindowLongW(hWndControl, GWL_STYLE);
741  if ((WindowStyle & BS_AUTOCHECKBOX) != BS_AUTOCHECKBOX) return FALSE;
742 
743  /* Is the key down ? */
744  if (SendMessageW(hWndControl, BM_GETCHECK, 0, 0) != BST_CHECKED) return TRUE;
745 
746  /* Extended key ? */
747  if (ScanCode & 0x0200)
748  bExtendedKey = TRUE;
749  else
750  bExtendedKey = FALSE;
752 
753  /* Release the key */
754  Input.type = INPUT_KEYBOARD;
755  Input.ki.wVk = 0;
756  Input.ki.wScan = ScanCode;
757  Input.ki.time = GetTickCount();
758  Input.ki.dwExtraInfo = GetMessageExtraInfo();
759  Input.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
760  if (bExtendedKey) Input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
761  SendInput(1, &Input, sizeof(Input));
762 
763  return TRUE;
764 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
ULONG ScanCode
Definition: api.c:39
#define KEYEVENTF_KEYUP
Definition: winuser.h:1096
#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:1905
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:1095
#define BST_CHECKED
Definition: winuser.h:197
#define SCANCODE_MASK
Definition: precomp.h:122
HWND hMainWnd
Definition: main.h:56
UINT WINAPI SendInput(UINT, LPINPUT, int)
Definition: ntwrapper.h:344

Referenced by OSK_Close().

◆ OSK_SetImage()

int OSK_SetImage ( int  IdDlgItem,
int  IdResource 
)

Definition at line 33 of file main.c.

34 {
35  HICON hIcon;
36  HWND hWndItem;
37 
39  IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
40  if (hIcon == NULL)
41  return FALSE;
42 
43  hWndItem = GetDlgItem(Globals.hMainWnd, IdDlgItem);
44  if (hWndItem == NULL)
45  {
47  return FALSE;
48  }
49 
51 
52  /* The system automatically deletes these resources when the process that created them terminates (MSDN) */
53 
54  return TRUE;
55 }
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:1909
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:1081
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_SetKeys().

◆ OSK_SetKeys()

LRESULT OSK_SetKeys ( int  reason)

Definition at line 188 of file main.c.

189 {
190  WCHAR wKey[2];
191  BYTE bKeyStates[256];
192  LPCWSTR szKey;
193  PKEY Keys;
194  UINT uVirtKey;
195  POINT LedPos;
196  SIZE LedSize;
197  int i, yPad;
198 
199  /* Get key states before doing anything */
200  if (!GetKeyboardState(bKeyStates))
201  {
202  DPRINT("OSK_SetKeys(): GetKeyboardState() call failed.\n");
203  return -1;
204  }
205 
206  switch (reason)
207  {
208  case SETKEYS_LANG:
209  {
210  /* Keyboard language/caps change, just update the button texts */
211  Keys = Globals.Keyboard->Keys;
212  for (i = 0; i < Globals.Keyboard->KeyCount; i++)
213  {
214  if (!Keys[i].translate)
215  continue;
216 
217  uVirtKey = MapVirtualKeyW(Keys[i].scancode & SCANCODE_MASK, MAPVK_VSC_TO_VK);
218 
219  if (ToUnicode(uVirtKey, Keys[i].scancode & SCANCODE_MASK, bKeyStates, wKey, _countof(wKey), 0) >= 1)
220  {
221  szKey = wKey;
222  }
223  else
224  {
225  szKey = Keys[i].name;
226  }
227 
228  /* Only one & the button will try to underline the next character... */
229  if (wcsncmp(szKey, L"&", 1) == 0)
230  szKey = L"&&";
231 
232  SetWindowTextW(Globals.hKeys[i], szKey);
233  }
234  return 0;
235  }
236  case SETKEYS_LAYOUT:
237  {
238  /* Clear up current layout before applying a different one */
239  OSK_DestroyKeys();
240  }
241  /* Fallthrough */
242  case SETKEYS_INIT:
243  {
244  if (Globals.bIsEnhancedKeyboard)
245  {
246  Globals.Keyboard = &EnhancedKeyboard;
247  }
248  else
249  {
250  Globals.Keyboard = &StandardKeyboard;
251  }
252 
253  Globals.hKeys = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HWND) * Globals.Keyboard->KeyCount);
254 
255  if (!Globals.hKeys)
256  {
257  DPRINT("OSK_SetKeys(): Failed to allocate memory for button handles.\n");
258  return -1;
259  }
260 
261  Keys = Globals.Keyboard->Keys;
262 
263  /* Create key buttons */
264  for (i = 0; i < Globals.Keyboard->KeyCount; i++)
265  {
266  uVirtKey = MapVirtualKeyW(Keys[i].scancode & SCANCODE_MASK, MAPVK_VSC_TO_VK);
267 
268  if (Keys[i].translate && ToUnicode(uVirtKey, Keys[i].scancode & SCANCODE_MASK, bKeyStates, wKey, _countof(wKey), 0) >= 1)
269  {
270  szKey = wKey;
271  }
272  else
273  {
274  szKey = Keys[i].name;
275  }
276 
278  szKey,
280  Keys[i].x,
281  Keys[i].y,
282  Keys[i].cx,
283  Keys[i].cy,
285  (HMENU)Keys[i].scancode,
287  NULL);
288  if (Globals.hFont)
290  }
291 
292  /* Add additional padding for caption and menu */
294  /* Size window according to layout */
296  (Globals.bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST),
297  0,
298  0,
299  Globals.Keyboard->Size.cx,
300  Globals.Keyboard->Size.cy + yPad,
301  SWP_NOMOVE);
302 
303  /* Create LEDs */
304  LedPos = Globals.Keyboard->LedStart;
305  LedSize = Globals.Keyboard->LedSize;
306 
308  LedPos.x, LedPos.y, LedSize.cx, LedSize.cy, Globals.hMainWnd,
310 
311  LedPos.x += Globals.Keyboard->LedGap;
312 
314  LedPos.x, LedPos.y, LedSize.cx, LedSize.cy, Globals.hMainWnd,
316 
317  LedPos.x += Globals.Keyboard->LedGap;
318 
320  LedPos.x, LedPos.y, LedSize.cx, LedSize.cy, Globals.hMainWnd,
322 
323  /* Set system keys text */
332  OSK_SetText(SCAN_CODE_58, IDS_CTRL); /* Left ctrl */
333  OSK_SetText(SCAN_CODE_64, IDS_CTRL); /* Right ctrl */
336 
337  /* Set icon on visual buttons */
354  }
355  }
356 
357  if (reason != SETKEYS_INIT)
358  {
361  }
362 
363  return 0;
364 }
#define SCAN_CODE_30
Definition: osk_res.h:103
#define IDS_LEFTALT
Definition: osk_res.h:65
Definition: precomp.h:25
#define SCAN_CODE_60
Definition: osk_res.h:131
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define SCAN_CODE_126
Definition: osk_res.h:177
#define SM_CYSIZE
Definition: winuser.h:986
long y
Definition: polytest.cpp:48
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define SCAN_CODE_128
Definition: osk_res.h:180
long x
Definition: polytest.cpp:48
#define IDI_PG_UP
Definition: osk_res.h:24
KEYBOARD_STRUCT StandardKeyboard
Definition: keyboard.c:240
KEYBOARD_STRUCT EnhancedKeyboard
Definition: keyboard.c:227
BOOL WINAPI UpdateWindow(_In_ HWND)
#define SCAN_CODE_75
Definition: osk_res.h:135
#define IDI_RIGHT
Definition: osk_res.h:28
#define SCAN_CODE_64
Definition: osk_res.h:134
#define HWND_TOPMOST
Definition: winuser.h:1198
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define SCAN_CODE_62
Definition: osk_res.h:133
#define IDS_PRN
Definition: osk_res.h:57
#define SCAN_CODE_79
Definition: osk_res.h:137
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define IDI_TOP
Definition: osk_res.h:27
UINT_PTR WPARAM
Definition: windef.h:207
#define IDI_TAB
Definition: osk_res.h:17
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDI_SHIFT
Definition: osk_res.h:20
#define IDS_NUMLOCKKEY
Definition: osk_res.h:61
#define IDS_ESCAPE
Definition: osk_res.h:56
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4296
HINSTANCE hInstance
Definition: main.h:55
#define SCAN_CODE_80
Definition: osk_res.h:138
#define IDC_LED_CAPS
Definition: osk_res.h:11
#define L(x)
Definition: ntvdm.h:50
#define SCAN_CODE_16
Definition: osk_res.h:89
#define IDI_LEFT
Definition: osk_res.h:26
int OSK_SetImage(int IdDlgItem, int IdResource)
Definition: main.c:33
#define IDI_BACK
Definition: osk_res.h:16
#define SCAN_CODE_57
Definition: osk_res.h:129
#define IDI_MENU
Definition: osk_res.h:22
#define IDS_RIGHTALT
Definition: osk_res.h:66
#define IDI_HOME
Definition: osk_res.h:23
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
void OSK_SetText(int IdDlgItem, int IdResource)
Definition: main.c:63
#define SCAN_CODE_124
Definition: osk_res.h:175
#define SCAN_CODE_86
Definition: osk_res.h:143
LONG cx
Definition: windef.h:334
#define SCAN_CODE_58
Definition: osk_res.h:130
UINT WINAPI MapVirtualKeyW(_In_ UINT, _In_ UINT)
#define SW_SHOW
Definition: winuser.h:769
#define IDS_STOP
Definition: osk_res.h:58
HFONT hFont
Definition: main.h:60
#define IDI_CAPS_LOCK
Definition: osk_res.h:18
#define IDS_INSERT
Definition: osk_res.h:60
#define MAPVK_VSC_TO_VK
Definition: winuser.h:2336
#define SS_CENTER
Definition: pedump.c:693
static void translate(POINT *pt, UINT count, const XFORM *xform)
Definition: metafile.c:2586
#define SCAN_CODE_125
Definition: osk_res.h:176
#define GetProcessHeap()
Definition: compat.h:595
#define SS_NOTIFY
Definition: winuser.h:351
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
int WINAPI GetSystemMetrics(_In_ int)
#define SCAN_CODE_110
Definition: osk_res.h:162
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
GLbitfield flags
Definition: glext.h:7161
#define IDC_LED_SCROLL
Definition: osk_res.h:12
#define IDS_ATTN
Definition: osk_res.h:59
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define IDI_REACTOS
Definition: osk_res.h:21
#define SCAN_CODE_89
Definition: osk_res.h:144
#define IDS_CTRL
Definition: osk_res.h:64
#define SCAN_CODE_15
Definition: osk_res.h:88
unsigned char BYTE
Definition: xxhash.c:193
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define IDI_RETURN
Definition: osk_res.h:19
#define SCAN_CODE_76
Definition: osk_res.h:136
VOID OSK_DestroyKeys(VOID)
Definition: main.c:162
#define SCAN_CODE_127
Definition: osk_res.h:179
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 SCAN_CODE_84
Definition: osk_res.h:141
#define WC_BUTTONW
Definition: commctrl.h:4623
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDI_BOTTOM
Definition: osk_res.h:29
#define SCAN_CODE_43
Definition: osk_res.h:116
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
int WINAPI ToUnicode(_In_ UINT wVirtKey, _In_ UINT wScanCode, _In_reads_bytes_opt_(256) CONST BYTE *lpKeyState, _Out_writes_(cchBuff) LPWSTR pwszBuff, _In_ int cchBuff, _In_ UINT wFlags)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define SCAN_CODE_90
Definition: osk_res.h:145
#define WM_SETFONT
Definition: winuser.h:1637
#define WC_STATICW
Definition: commctrl.h:4680
_Out_opt_ int * cx
Definition: commctrl.h:585
#define IDS_END
Definition: osk_res.h:63
#define SCANCODE_MASK
Definition: precomp.h:122
#define SWP_NOMOVE
Definition: winuser.h:1234
#define SM_CYMENU
Definition: winuser.h:970
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define HWND_NOTOPMOST
Definition: winuser.h:1196
#define IDS_DELETE
Definition: resource.h:40
#define SCAN_CODE_85
Definition: osk_res.h:142
#define SCAN_CODE_44
Definition: osk_res.h:117
#define IDC_LED_NUM
Definition: osk_res.h:10
#define DPRINT
Definition: sndvol32.h:71
#define SCAN_CODE_83
Definition: osk_res.h:140
#define WS_VISIBLE
Definition: pedump.c:620
LPCWSTR name
Definition: precomp.h:27
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
HWND hMainWnd
Definition: main.h:56
LONG cy
Definition: windef.h:335
#define IDI_PG_DOWN
Definition: osk_res.h:25
#define SCAN_CODE_81
Definition: osk_res.h:139
#define SCAN_CODE_129
Definition: osk_res.h:181

Referenced by OSK_Create(), OSK_Timer(), and OSK_WndProc().

◆ OSK_SetText()

void OSK_SetText ( int  IdDlgItem,
int  IdResource 
)

Definition at line 63 of file main.c.

64 {
65  WCHAR szText[MAX_PATH];
66  HWND hWndItem;
67 
68  hWndItem = GetDlgItem(Globals.hMainWnd, IdDlgItem);
69 
70  if (hWndItem == NULL)
71  return;
72 
73  LoadStringW(Globals.hInstance, IdResource, szText, _countof(szText));
74 
75  SetWindowTextW(hWndItem, szText);
76 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE hInstance
Definition: main.h:55
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define NULL
Definition: types.h:112
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_SetKeys().

◆ OSK_Timer()

int OSK_Timer ( void  )

Definition at line 544 of file main.c.

545 {
546  HWND hWndActiveWindow;
547  DWORD dwThread;
548  HKL hKeyboardLayout;
549 
550  hWndActiveWindow = GetForegroundWindow();
551  if (hWndActiveWindow != NULL && hWndActiveWindow != Globals.hMainWnd)
552  {
553  /* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
554  Globals.hActiveWnd = hWndActiveWindow;
555 
556  /* Grab the current keyboard layout from the foreground window */
557  dwThread = GetWindowThreadProcessId(hWndActiveWindow, NULL);
558  hKeyboardLayout = GetKeyboardLayout(dwThread);
559  /* Activate the layout */
560  ActivateKeyboardLayout(hKeyboardLayout, 0);
561  }
562 
563  /*
564  Update the LED key indicators accordingly to their state (if one
565  of the specific keys is held down).
566  */
568  /* Update the buttons */
570 
571  return TRUE;
572 }
HKL WINAPI ActivateKeyboardLayout(_In_ HKL, _In_ UINT)
NOTEPAD_GLOBALS Globals
Definition: main.c:31
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
#define TRUE
Definition: types.h:120
VOID OSK_RefreshLEDKeys(VOID)
Definition: main.c:522
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT OSK_SetKeys(int reason)
Definition: main.c:188
UINT_PTR HKL
Definition: msctf.idl:101
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
#define NULL
Definition: types.h:112
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_WndProc().

◆ OSK_WarningDlgThread()

DWORD WINAPI OSK_WarningDlgThread ( LPVOID  lpParameter)

Definition at line 124 of file main.c.

125 {
126  HINSTANCE hInstance = (HINSTANCE)lpParameter;
127 
129  return 0;
130 }
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4379
HINSTANCE hInstance
Definition: main.c:36
HANDLE HINSTANCE
Definition: typedefs.h:77
INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:83
#define IDD_WARNINGDIALOG_OSK
Definition: osk_res.h:47
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HWND hMainWnd
Definition: main.h:56

Referenced by OSK_Create().

◆ OSK_WarningProc()

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

Definition at line 83 of file main.c.

84 {
86 
87  switch (Msg)
88  {
89  case WM_INITDIALOG:
90  {
91  return TRUE;
92  }
93 
94  case WM_COMMAND:
95  {
96  switch (LOWORD(wParam))
97  {
99  {
100  Globals.bShowWarning = !IsDlgButtonChecked(hDlg, IDC_SHOWWARNINGCHECK);
101  return TRUE;
102  }
103 
104  case IDOK:
105  case IDCANCEL:
106  {
107  EndDialog(hDlg, LOWORD(wParam));
108  return TRUE;
109  }
110  }
111  break;
112  }
113  }
114 
115  return FALSE;
116 }
#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)
#define WM_COMMAND
Definition: winuser.h:1727
#define IDCANCEL
Definition: winuser.h:825
struct @1590 Msg[]
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by OSK_Create(), and OSK_WarningDlgThread().

◆ OSK_WndProc()

LRESULT APIENTRY OSK_WndProc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 813 of file main.c.

814 {
815  switch (msg)
816  {
817  case WM_CREATE:
818  return OSK_Create(hwnd);
819 
820  case WM_PAINT:
821  return OSK_Paint(hwnd);
822 
823  case WM_TIMER:
824  return OSK_Timer();
825 
826  case WM_CTLCOLORSTATIC:
828  {
829  if (GetKeyState(VK_NUMLOCK) & 0x0001)
830  return (LRESULT)Globals.hBrushGreenLed;
831  else
833  }
835  {
836  if (GetKeyState(VK_CAPITAL) & 0x0001)
837  return (LRESULT)Globals.hBrushGreenLed;
838  else
840  }
842  {
843  if (GetKeyState(VK_SCROLL) & 0x0001)
844  return (LRESULT)Globals.hBrushGreenLed;
845  else
847  }
848  break;
849 
850  case WM_COMMAND:
851  switch (LOWORD(wParam))
852  {
853  case IDM_EXIT:
854  {
855  PostMessageW(hwnd, WM_CLOSE, 0, 0);
856  break;
857  }
858 
859  case IDM_ENHANCED_KB:
860  {
861  if (!Globals.bIsEnhancedKeyboard)
862  {
863  /*
864  The user attempted to switch to enhanced keyboard dialog type.
865  Set the member value as TRUE, destroy the dialog and save the data configuration into the registry.
866  */
867  Globals.bIsEnhancedKeyboard = TRUE;
868  SaveSettings();
869 
870  /* Change the condition of enhanced keyboard item menu to checked */
873 
874  /* Finally, update the key layout */
875  LoadSettings();
877  }
878 
879  break;
880  }
881 
882  case IDM_STANDARD_KB:
883  {
884  if (Globals.bIsEnhancedKeyboard)
885  {
886  /*
887  The user attempted to switch to standard keyboard dialog type.
888  Set the member value as FALSE, destroy the dialog and save the data configuration into the registry.
889  */
890  Globals.bIsEnhancedKeyboard = FALSE;
891  SaveSettings();
892 
893  /* Change the condition of standard keyboard item menu to checked */
896 
897  /* Finally, update the key layout */
898  LoadSettings();
900  }
901 
902  break;
903  }
904 
905  case IDM_CLICK_SOUND:
906  {
907  /*
908  This case is triggered when the user attempts to click on the menu item. Before doing anything,
909  we must check the condition state of such menu item so that we can tick/untick the menu item accordingly.
910  */
911  if (!Globals.bSoundClick)
912  {
913  Globals.bSoundClick = TRUE;
915  }
916  else
917  {
918  Globals.bSoundClick = FALSE;
920  }
921 
922  break;
923  }
924 
925  case IDM_ON_TOP:
926  {
927  /*
928  Check the condition state before disabling/enabling the menu
929  item and change the topmost order.
930  */
931  if (!Globals.bAlwaysOnTop)
932  {
933  Globals.bAlwaysOnTop = TRUE;
936  }
937  else
938  {
939  Globals.bAlwaysOnTop = FALSE;
942  }
943 
944  break;
945  }
946 
947  case IDM_FONT:
948  {
949  OSK_ChooseFont();
950  break;
951  }
952 
953  case IDM_ABOUT:
954  {
955  OSK_About();
956  break;
957  }
958 
959  default:
961  break;
962  }
963  return 0;
964 
965  case WM_THEMECHANGED:
966  /* Redraw the dialog (and its control buttons) using the new theme */
968  return 0;
969 
970  case WM_CLOSE:
971  OSK_Close();
972  PostQuitMessage(0);
973  return 0;
974  }
975  return DefWindowProcW(hwnd, msg, wParam, lParam);
976 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
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
BOOL OSK_Command(WPARAM wCommand, HWND hWndControl)
Definition: main.c:622
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1759
#define HWND_TOPMOST
Definition: winuser.h:1198
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void SaveSettings(void)
Definition: settings.c:115
#define IDC_LED_CAPS
Definition: osk_res.h:11
void LoadSettings(void)
Definition: settings.c:53
#define FALSE
Definition: types.h:117
#define IDM_FONT
Definition: osk_res.h:43
int OSK_Close(void)
Definition: main.c:490
#define IDM_ON_TOP
Definition: osk_res.h:40
SHORT WINAPI GetKeyState(_In_ int)
#define BLACK_BRUSH
Definition: wingdi.h:896
#define IDM_STANDARD_KB
Definition: osk_res.h:33
#define MF_CHECKED
Definition: winuser.h:132
VOID OSK_ChooseFont(VOID)
Definition: main.c:580
#define IDM_ENHANCED_KB
Definition: osk_res.h:34
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_TIMER
Definition: winuser.h:1729
int OSK_Timer(void)
Definition: main.c:544
#define WM_CLOSE
Definition: winuser.h:1608
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
LRESULT OSK_SetKeys(int reason)
Definition: main.c:188
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define WM_PAINT
Definition: winuser.h:1607
#define IDC_LED_SCROLL
Definition: osk_res.h:12
LRESULT OSK_Paint(HWND hwnd)
Definition: main.c:772
LRESULT OSK_Create(HWND hwnd)
Definition: main.c:372
#define WM_COMMAND
Definition: winuser.h:1727
#define MF_UNCHECKED
Definition: winuser.h:204
#define SWP_NOSIZE
Definition: winuser.h:1235
VOID OSK_About(VOID)
Definition: main.c:138
#define VK_SCROLL
Definition: winuser.h:2260
#define VK_NUMLOCK
Definition: winuser.h:2259
#define VK_CAPITAL
Definition: winuser.h:2186
#define NULL
Definition: types.h:112
#define IDM_EXIT
Definition: resource.h:27
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1595
#define SWP_NOMOVE
Definition: winuser.h:1234
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define HWND_NOTOPMOST
Definition: winuser.h:1196
#define IDC_LED_NUM
Definition: osk_res.h:10
LONG_PTR LRESULT
Definition: windef.h:209
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
HMENU WINAPI GetMenu(_In_ HWND)
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define IDM_CLICK_SOUND
Definition: osk_res.h:41

Referenced by wWinMain().

◆ wWinMain()

int WINAPI wWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPWSTR  lpCmdLine,
int  nShowCmd 
)

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 982 of file main.c.

986 {
987  DWORD dwError;
988  HANDLE hMutex;
989  INITCOMMONCONTROLSEX iccex;
990  WNDCLASSEXW wc = {0};
991  MSG msg;
992  HWND hwnd;
993 
997 
998  /*
999  Obtain a mutex for the program. This will ensure that
1000  the program is launched only once.
1001  */
1002  hMutex = CreateMutexW(NULL, FALSE, L"OSKRunning");
1003 
1004  if (hMutex)
1005  {
1006  /* Check if there's already a mutex for the program */
1007  dwError = GetLastError();
1008 
1009  if (dwError == ERROR_ALREADY_EXISTS)
1010  {
1011  /*
1012  A mutex with the object name has been created previously.
1013  Therefore, another instance is already running.
1014  */
1015  DPRINT("wWinMain(): Failed to create a mutex! The program instance is already running.\n");
1017  return 0;
1018  }
1019  }
1020 
1021  /* Load the common controls */
1022  iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
1024  InitCommonControlsEx(&iccex);
1025 
1026  ZeroMemory(&Globals, sizeof(Globals));
1028 
1029  /* Load the application's settings from the registry */
1030  LoadSettings();
1031 
1032  /* Define the window class */
1033  wc.cbSize = sizeof(wc);
1035  wc.lpfnWndProc = OSK_WndProc;
1037  wc.lpszClassName = OSK_CLASS;
1038  wc.style = CS_HREDRAW | CS_VREDRAW;
1039  wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
1040  /* Set the application's icon */
1043 
1044  if (!RegisterClassExW(&wc))
1045  goto quit;
1046 
1047  /* Load window title */
1049 
1051  OSK_CLASS,
1052  Globals.szTitle,
1054  CW_USEDEFAULT,
1055  CW_USEDEFAULT,
1056  CW_USEDEFAULT,
1057  CW_USEDEFAULT,
1058  NULL,
1059  NULL,
1061  NULL);
1062 
1063  if (!hwnd)
1064  goto quit;
1065 
1067  UpdateWindow(hwnd);
1068 
1069  while (GetMessageW(&msg, NULL, 0, 0))
1070  {
1073  }
1074 
1075 quit:
1076  /* Delete the mutex */
1077  if (hMutex)
1078  {
1080  }
1081 
1082  return 0;
1083 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define CloseHandle
Definition: compat.h:598
NOTEPAD_GLOBALS Globals
Definition: main.c:31
#define LR_SHARED
Definition: winuser.h:1094
#define IMAGE_ICON
Definition: winuser.h:212
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
void quit(int argc, const char *argv[])
Definition: cmds.c:1606
#define IDI_OSK
Definition: osk_res.h:15
BOOL WINAPI UpdateWindow(_In_ HWND)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1667
#define CS_HREDRAW
Definition: winuser.h:648
#define SM_CYSMICON
Definition: winuser.h:1007
HICON hIcon
Definition: winuser.h:3202
TCHAR * cmdline
Definition: stretchblt.cpp:32
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define COLOR_WINDOW
Definition: winuser.h:912
HINSTANCE hInstance
Definition: main.h:55
#define IDS_OSK
Definition: osk_res.h:49
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
#define L(x)
Definition: ntvdm.h:50
LPCWSTR lpszMenuName
Definition: winuser.h:3205
void LoadSettings(void)
Definition: settings.c:53
#define FALSE
Definition: types.h:117
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
HANDLE hMutex
Definition: mutex.c:11
#define SW_SHOW
Definition: winuser.h:769
LPCWSTR lpszClassName
Definition: winuser.h:3206
LRESULT APIENTRY OSK_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:813
#define CS_VREDRAW
Definition: winuser.h:653
#define LR_DEFAULTSIZE
Definition: winuser.h:1088
HBRUSH hbrBackground
Definition: winuser.h:3204
UINT cbSize
Definition: winuser.h:3196
#define _countof(array)
Definition: sndvol32.h:68
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
HINSTANCE hInstance
Definition: main.c:36
HINSTANCE hInstance
Definition: winuser.h:3201
#define SM_CXSMICON
Definition: winuser.h:1006
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define WS_EX_TOPMOST
Definition: pedump.c:647
UINT style
Definition: winuser.h:3197
WNDPROC lpfnWndProc
Definition: winuser.h:3198
#define OSK_CLASS
Definition: precomp.h:126
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1093
#define WS_MINIMIZEBOX
Definition: pedump.c:631
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
#define NULL
Definition: types.h:112
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
HICON hIconSm
Definition: winuser.h:3207
#define msg(x)
Definition: auth_time.c:54
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define DPRINT
Definition: sndvol32.h:71
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IDR_OSK_MENU
Definition: osk_res.h:31
#define WS_SYSMENU
Definition: pedump.c:629

Variable Documentation

◆ Globals

OSK_GLOBALS Globals

Definition at line 16 of file main.c.

◆ LedKey

Initial value:
=
{
}
#define IDC_LED_CAPS
Definition: osk_res.h:11
#define FALSE
Definition: types.h:117
#define IDC_LED_SCROLL
Definition: osk_res.h:12
#define VK_SCROLL
Definition: winuser.h:2260
#define VK_NUMLOCK
Definition: winuser.h:2259
#define VK_CAPITAL
Definition: winuser.h:2186
#define IDC_LED_NUM
Definition: osk_res.h:10

Definition at line 18 of file main.c.

Referenced by OSK_Command(), OSK_DestroyKeys(), and OSK_RefreshLEDKeys().