Added english controls to winecfg About tab for registration info Added code for retrieving and setting registration info Added textbox identifiers
filipe
filipe at tinypad.net
Sun Jun 22 22:47:29 CDT 2008
---
programs/winecfg/En.rc | 5 +++
programs/winecfg/main.c | 66 ++++++++++++++++++++++++++++++++++++++++--
programs/winecfg/resource.h | 4 ++
3 files changed, 71 insertions(+), 4 deletions(-)
diff --git a/programs/winecfg/En.rc b/programs/winecfg/En.rc
index afcb47f..1a07d71 100644
--- a/programs/winecfg/En.rc
+++ b/programs/winecfg/En.rc
@@ -41,6 +41,11 @@ BEGIN
LTEXT "http://www.winehq.org/",IDC_STATIC,119,31,106,8
LTEXT "This program is free software; you can
redistribute it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later
version.",
IDC_STATIC,119,44,124,72
+ GROUPBOX " Windows Registration Information ", IDC_STATIC,
15, 110, 230, 55
+ LTEXT "Owner:", IDC_STATIC, 22, 126, 40, 20
+ LTEXT "Organization:", IDC_STATIC, 22, 140, 50, 20
+ EDITTEXT IDC_ABT_OWNER, 75, 126, 160, 13, ES_AUTOHSCROLL |
WS_TABSTOP
+ EDITTEXT IDC_ABT_ORG, 75, 140, 160, 13, ES_AUTOHSCROLL | WS_TABSTOP
END
IDD_APPCFG DIALOG DISCARDABLE 0, 0, 260, 250
diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c
index f9f561d..10f87cf 100644
--- a/programs/winecfg/main.c
+++ b/programs/winecfg/main.c
@@ -62,13 +62,71 @@ AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
switch (uMsg) {
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code != PSN_SETACTIVE) break;
- /* otherwise fall through, we want to refresh the page as well */
- case WM_INITDIALOG:
+ switch(((LPNMHDR)lParam)->code)
+ {
+ case PSN_KILLACTIVE:
+ {
+ /* check to see if something is entered */
+ if(GetWindowTextLength(GetDlgItem(hDlg, IDC_ABT_OWNER)) == 0
|| GetWindowTextLength(GetDlgItem(hDlg, IDC_ABT_ORG)) == 0)
+ {
+ MessageBox(NULL, "Owner and/or Organization
empty!", "Error", MB_OK | MB_ICONERROR);
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT,
PSNRET_INVALID_NOCHANGEPAGE);
+ return TRUE;
+ }
+ else
+ {
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
+ return FALSE;
+ }
+ }
+ break;
+
+ case PSN_APPLY:
+ {
+ /*save registration info to registry */
+ char *owner, *org;
+ owner = get_text(hDlg, IDC_ABT_OWNER);
+ org = get_text(hDlg, IDC_ABT_ORG);
+
+ set_reg_key(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOwner",
owner);
+ set_reg_key(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows NT\\CurrentVersion",
"RegisteredOrganization", org);
+ apply();
+
+ HeapFree(GetProcessHeap(), 0, owner);
+ HeapFree(GetProcessHeap(), 0, org);
+ }
break;
+ }
+ break;
+
+
+ case WM_INITDIALOG:
+ {
+ /* read owner and organization info from registry,
load it into text box */
+ char *owner = get_reg_key(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOwner",
"Unable to retrieve owner.");
+ char *org = get_reg_key(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows NT\\CurrentVersion",
"RegisteredOrganization", "Unable to retrieve organization.");
+
+ SetDlgItemText(hDlg, IDC_ABT_OWNER, owner);
+ SetDlgItemText(hDlg, IDC_ABT_ORG, org);
+
+ SendMessage(GetParent(hDlg), PSM_UNCHANGED, 0, 0);
+
+ HeapFree(GetProcessHeap(), 0, owner);
+ HeapFree(GetProcessHeap(), 0, org);
+ }
+ break;
case WM_COMMAND:
- break;
+ switch(HIWORD(wParam))
+ {
+ case EN_CHANGE:
+ {
+ /* enable apply button */
+ SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+ }
+ break;
default:
break;
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index 2ce1ab9..2182c29 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -249,3 +249,7 @@
#define IDC_SYSPARAMS_INACTIVE_TITLE_GRADIENT 8429
#define IDC_SYSPARAMS_MENU_HILIGHT 8430
#define IDC_SYSPARAMS_MENUBAR 8431
+
+/* About tab */
+#define IDC_ABT_OWNER 8432
+#define IDC_ABT_ORG 8433
--
1.5.4.3
More information about the wine-patches
mailing list