oleview: Added system configuration dialog.

This commit is contained in:
Piotr Caban 2006-06-22 21:14:42 +02:00 committed by Alexandre Julliard
parent 0defa4e807
commit 0f0ee255f6
3 changed files with 93 additions and 1 deletions

View File

@ -128,3 +128,16 @@ FONT 8, "MS Shell Dlg"
DEFPUSHBUTTON "&OK", IDOK, 200, 5, 45, 14
PUSHBUTTON "&Cancel", IDCANCEL, 200, 22, 45, 14
}
DLG_SYSCONF DIALOG DISCARDABLE 0, 0, 170, 100
STYLE DS_MODALFRAME | DS_NOIDLEMSG | WS_CAPTION | WS_SYSMENU
CAPTION "System Configuration"
FONT 8, "MS Shell Dlg"
{
LTEXT "System Settings", IDIGNORE, 5, 6, 160, 8
CHECKBOX "&Enable Distributed COM", IDC_ENABLEDCOM, 5, 20, 160, 10, WS_TABSTOP | WS_GROUP | BS_AUTOCHECKBOX
CHECKBOX "Enable &Remote Connections (Win95 only)", IDC_ENABLEREMOTE, 5, 35, 160, 10, WS_TABSTOP | WS_GROUP | BS_AUTOCHECKBOX
LTEXT "These settings changes only register values.\nIt has no effect on Wine performance.", IDIGNORE, 5, 50, 160, 40
DEFPUSHBUTTON "&OK", IDOK, 70, 80, 45, 14
PUSHBUTTON "&Cancel", IDCANCEL, 120, 80, 45, 14
}

View File

@ -24,7 +24,79 @@ GLOBALS globals;
static WCHAR wszRegEdit[] = { 'r','e','g','e','d','i','t','.','e','x','e','\0' };
static WCHAR wszFormat[] = { '<','o','b','j','e','c','t','\n',' ',' ',' ',
'c','l','a','s','s','i','d','=','\"','c','l','s','i','d',':','%','s','\"','\n',
'>','\n','<','/','o','b','j','e','c','t','>' };
'>','\n','<','/','o','b','j','e','c','t','>','\0' };
INT_PTR CALLBACK SysConfProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HKEY hKey;
WCHAR buffer[MAX_LOAD_STRING];
DWORD bufSize;
WCHAR wszReg[] = { 'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\','O','L','E','\\','\0' };
WCHAR wszEnableDCOM[] = { 'E','n','a','b','l','e','D','C','O','M','\0' };
WCHAR wszEnableRemote[] = { 'E','n','a','b','l','e',
'R','e','m','o','t','e','C','o','n','n','e','c','t','\0' };
WCHAR wszYes[] = { 'Y', '\0' };
WCHAR wszNo[] = { 'N', '\0' };
switch(uMsg)
{
case WM_INITDIALOG:
if(RegOpenKey(HKEY_LOCAL_MACHINE, wszReg, &hKey) != ERROR_SUCCESS)
RegCreateKey(HKEY_LOCAL_MACHINE, wszReg, &hKey);
bufSize = sizeof(buffer);
if(RegGetValue(hKey, NULL, wszEnableDCOM, RRF_RT_REG_SZ,
NULL, buffer, &bufSize) != ERROR_SUCCESS)
{
bufSize = sizeof(wszYes);
RegSetValueEx(hKey, wszEnableDCOM, 0, REG_SZ, (BYTE*)wszYes, bufSize);
}
CheckDlgButton(hDlgWnd, IDC_ENABLEDCOM,
buffer[0]=='Y' ? BST_CHECKED : BST_UNCHECKED);
bufSize = sizeof(buffer);
if(RegGetValue(hKey, NULL, wszEnableRemote, RRF_RT_REG_SZ,
NULL, buffer, &bufSize) != ERROR_SUCCESS)
{
bufSize = sizeof(wszYes);
RegSetValueEx(hKey, wszEnableRemote, 0, REG_SZ, (BYTE*)wszYes, bufSize);
}
CheckDlgButton(hDlgWnd, IDC_ENABLEREMOTE,
buffer[0]=='Y' ? BST_CHECKED : BST_UNCHECKED);
RegCloseKey(hKey);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK:
bufSize = sizeof(wszYes);
RegOpenKey(HKEY_LOCAL_MACHINE, wszReg, &hKey);
RegSetValueEx(hKey, wszEnableDCOM, 0, REG_SZ,
IsDlgButtonChecked(hDlgWnd, IDC_ENABLEDCOM) == BST_CHECKED ?
(BYTE*)wszYes : (BYTE*)wszNo, bufSize);
RegSetValueEx(hKey, wszEnableRemote, 0, REG_SZ,
IsDlgButtonChecked(hDlgWnd, IDC_ENABLEREMOTE) == BST_CHECKED ?
(BYTE*)wszYes : (BYTE*)wszNo, bufSize);
RegCloseKey(hKey);
EndDialog(hDlgWnd, IDOK);
return TRUE;
case IDCANCEL:
EndDialog(hDlgWnd, IDCANCEL);
return TRUE;
}
}
return FALSE;
}
INT_PTR CALLBACK CreateInstOnProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@ -295,6 +367,9 @@ int MenuCommand(WPARAM wParam, HWND hWnd)
vis ? MF_UNCHECKED : MF_CHECKED);
ResizeChild();
break;
case IDM_SYSCONF:
DialogBox(0, MAKEINTRESOURCE(DLG_SYSCONF), hWnd, SysConfProc);
break;
case IDM_TOOLBAR:
vis = IsWindowVisible(globals.hToolBar);
ShowWindow(globals.hToolBar, vis ? SW_HIDE : SW_SHOW);

View File

@ -70,3 +70,7 @@
#define DLG_CREATEINSTON 1000
#define IDC_MACHINE 1001
#define DLG_SYSCONF 1010
#define IDC_ENABLEDCOM 1011
#define IDC_ENABLEREMOTE 1012