In Windows XP, both in On-Screen Keyboard and in Magnify there is a welcome box which is shown upon startup of the application. This feature is already implemented for Magnify in ReactOS which however in On-Screen Keyboard is still unimplemented.
file(GLOB osk_rc_deps res/*.*)
add_rc_deps(rsrc.rc ${osk_rc_deps})
-add_executable(osk main.c rsrc.rc)
+add_executable(osk main.c settings.c rsrc.rc)
set_module_type(osk win32gui UNICODE)
add_importlibs(osk comdlg32 shell32 user32 gdi32 advapi32 comctl32 msvcrt kernel32)
add_cd_file(TARGET osk DESTINATION reactos/system32 FOR all)
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,443,15,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,443,15,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,443,15,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,443,15,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
CONTROL "",IDC_LED_SCROLL,"Static",SS_CENTER|SS_NOTIFY,580,16,4,3
END
+IDD_WARNINGDIALOG_OSK DIALOGEX 0, 0, 250, 97
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
+CAPTION "On-Screen Keyboard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK", IDOK, 193, 76, 50, 14
+ ICON IDI_OSK, IDC_STATIC, 7, 17, 20, 20
+ LTEXT "On-Screen Keyboard provides a minimum level of functionality for mobility-impaired users. Mobility-impaired users will need a utility program with higher functionality for daily use.", IDC_STATIC, 36, 7, 207, 33
+ CONTROL "Do not show this message again", IDC_SHOWWARNINGCHECK, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 43, 80, 137, 10
+END
+
/* EOF */
/* INCLUDES *******************************************************************/
#include "osk.h"
+#include "settings.h"
/* GLOBALS ********************************************************************/
return TRUE;
}
+/***********************************************************************
+ *
+ * OSK_WarningProc
+ *
+ * Function handler for the warning dialog box on startup
+ */
+INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+ UNREFERENCED_PARAMETER(lParam);
+
+ switch (Msg)
+ {
+ case WM_INITDIALOG:
+ {
+ return TRUE;
+ }
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_SHOWWARNINGCHECK:
+ {
+ Globals.bShowWarning = !IsDlgButtonChecked(hDlg, IDC_SHOWWARNINGCHECK);
+ return TRUE;
+ }
+
+ case IDOK:
+ case IDCANCEL:
+ {
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ }
+ }
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
/***********************************************************************
*
/* Save handle */
Globals.hMainWnd = hDlg;
+ /* Load the settings from the registry hive */
+ LoadDataFromRegistry();
+
/* Get screen info */
memset(&Pt, 0, sizeof(Pt));
monitor = MonitorFromPoint(Pt, MONITOR_DEFAULTTOPRIMARY );
/* Set a timer for periodics tasks */
Globals.iTimer = SetTimer(hDlg, 0, 200, NULL);
+ /* If the member of the struct (bShowWarning) is set then display the dialog box */
+ if (Globals.bShowWarning)
+ {
+ DialogBox(Globals.hInstance, MAKEINTRESOURCE(IDD_WARNINGDIALOG_OSK), Globals.hMainWnd, OSK_WarningProc);
+ }
+
return TRUE;
}
/* delete GDI objects */
if (Globals.hBrushGreenLed) DeleteObject(Globals.hBrushGreenLed);
+ /* Save the settings to the registry hive */
+ SaveDataToRegistry();
+
return TRUE;
}
UINT_PTR iTimer;
/* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
HWND hActiveWnd;
+ BOOL bShowWarning;
} OSK_GLOBALS;
/* DEFINES ********************************************************************/
#define IDC_LED_NUM 100
#define IDC_LED_CAPS 101
#define IDC_LED_SCROLL 102
+#define IDC_SHOWWARNINGCHECK 103
#define IDI_OSK 200
#define IDI_BACK 201
#define IDI_RIGHT 213
#define IDI_BOTTOM 214
+#define IDD_WARNINGDIALOG_OSK 215
+
#define IDC_STATIC -1
--- /dev/null
+/*
+ * PROJECT: ReactOS On-Screen Keyboard
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Settings file for warning dialog on startup
+ * COPYRIGHT: Copyright 2018 Bișoc George (fraizeraust99 at gmail dot com)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include "osk.h"
+#include "settings.h"
+
+/* FUNCTIONS *******************************************************************/
+
+BOOL LoadDataFromRegistry()
+{
+ HKEY hKey;
+ LONG lResult;
+ DWORD dwData;
+ DWORD cbData = sizeof(DWORD);
+
+ /* Set the structure member to TRUE */
+ Globals.bShowWarning = TRUE;
+
+ /* Open the key, so that we can query it */
+ lResult = RegOpenKeyExW(HKEY_CURRENT_USER,
+ L"Software\\Microsoft\\osk",
+ 0,
+ KEY_READ,
+ &hKey);
+
+ if (lResult != ERROR_SUCCESS)
+ {
+ /* Bail out and return FALSE if we fail */
+ return FALSE;
+ }
+
+ /* Query the key */
+ lResult = RegQueryValueExW(hKey,
+ L"ShowWarning",
+ 0,
+ 0,
+ (BYTE *)&dwData,
+ &cbData);
+
+ if (lResult != ERROR_SUCCESS)
+ {
+ /* Bail out and return FALSE if we fail */
+ RegCloseKey(hKey);
+ return FALSE;
+ }
+
+ /* Load the data value (it can be either FALSE or TRUE depending on the data itself) */
+ Globals.bShowWarning = (dwData != 0);
+
+ /* If we're here then we succeed, close the key and return TRUE */
+ RegCloseKey(hKey);
+ return TRUE;
+}
+
+BOOL SaveDataToRegistry()
+{
+ HKEY hKey;
+ LONG lResult;
+ DWORD dwData;
+
+ /* If no key has been made, create one */
+ lResult = RegCreateKeyExW(HKEY_CURRENT_USER,
+ L"Software\\Microsoft\\osk",
+ 0,
+ NULL,
+ 0,
+ KEY_WRITE,
+ NULL,
+ &hKey,
+ NULL);
+
+ if (lResult != ERROR_SUCCESS)
+ {
+ /* Bail out and return FALSE if we fail */
+ return FALSE;
+ }
+
+ /* The data value of the subkey will be appended to the warning dialog switch */
+ dwData = Globals.bShowWarning;
+
+ lResult = RegSetValueExW(hKey,
+ L"ShowWarning",
+ 0,
+ REG_DWORD,
+ (BYTE *)&dwData,
+ sizeof(dwData));
+
+ if (lResult != ERROR_SUCCESS)
+ {
+ /* Bail out and return FALSE if we fail */
+ RegCloseKey(hKey);
+ return FALSE;
+ }
+
+ /* If we're here then we succeed, close the key and return TRUE */
+ RegCloseKey(hKey);
+ return TRUE;
+}
--- /dev/null
+/*
+ * PROJECT: ReactOS On-Screen Keyboard
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Settings header file with function prototypes
+ * COPYRIGHT: Copyright 2018 Bișoc George (fraizeraust99 at gmail dot com)
+ */
+
+#ifndef SETTINGS_OSK_H
+#define SETTINGS_OSK_H
+
+BOOL LoadDataFromRegistry(VOID);
+BOOL SaveDataToRegistry(VOID);
+INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
+
+#endif // SETTINGS_OSK_H