[OSK] Implement the welcome box (#1007)

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.
This commit is contained in:
Bișoc George 2018-11-17 21:27:33 +01:00 committed by Hermès BÉLUSCA - MAÏTO
parent 9ff64cfebb
commit 34c812365f
22 changed files with 370 additions and 1 deletions

View file

@ -1,7 +1,7 @@
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)

View file

@ -125,4 +125,16 @@ BEGIN
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 */

View file

@ -125,4 +125,16 @@ BEGIN
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 */

View file

@ -126,4 +126,16 @@ BEGIN
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 */

View file

@ -126,4 +126,16 @@ BEGIN
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 */

View file

@ -125,4 +125,16 @@ BEGIN
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 */

View file

@ -127,4 +127,16 @@ BEGIN
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 */

View file

@ -126,4 +126,16 @@ BEGIN
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 */

View file

@ -126,4 +126,16 @@ BEGIN
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 */

View file

@ -125,4 +125,16 @@ BEGIN
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 */

View file

@ -126,4 +126,16 @@ BEGIN
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 */

View file

@ -125,4 +125,16 @@ BEGIN
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 */

View file

@ -126,4 +126,16 @@ BEGIN
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 */

View file

@ -125,4 +125,16 @@ BEGIN
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 */

View file

@ -125,4 +125,16 @@ BEGIN
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 */

View file

@ -127,4 +127,16 @@ BEGIN
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 */

View file

@ -127,4 +127,16 @@ BEGIN
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 */

View file

@ -9,6 +9,7 @@
/* INCLUDES *******************************************************************/
#include "osk.h"
#include "settings.h"
/* GLOBALS ********************************************************************/
@ -57,6 +58,47 @@ int OSK_SetImage(int IdDlgItem, int IdResource)
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;
}
/***********************************************************************
*
@ -74,6 +116,9 @@ int OSK_DlgInitDialog(HWND hDlg)
/* 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 );
@ -115,6 +160,12 @@ int OSK_DlgInitDialog(HWND hDlg)
/* 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;
}
@ -139,6 +190,9 @@ int OSK_DlgClose(void)
/* delete GDI objects */
if (Globals.hBrushGreenLed) DeleteObject(Globals.hBrushGreenLed);
/* Save the settings to the registry hive */
SaveDataToRegistry();
return TRUE;
}

View file

@ -23,6 +23,7 @@ typedef struct
UINT_PTR iTimer;
/* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
HWND hActiveWnd;
BOOL bShowWarning;
} OSK_GLOBALS;
/* DEFINES ********************************************************************/

View file

@ -11,6 +11,7 @@
#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
@ -28,6 +29,8 @@
#define IDI_RIGHT 213
#define IDI_BOTTOM 214
#define IDD_WARNINGDIALOG_OSK 215
#define IDC_STATIC -1

View file

@ -0,0 +1,104 @@
/*
* 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;
}

View file

@ -0,0 +1,15 @@
/*
* 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