Owen Rudge : appwiz.cpl: Display Add/Remove Programs dialog.
Alexandre Julliard
julliard at winehq.org
Fri Jul 25 08:13:42 CDT 2008
Module: wine
Branch: master
Commit: 6d4f3d5d3ab51d551bbab6d8ef6df869e3bf67db
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d4f3d5d3ab51d551bbab6d8ef6df869e3bf67db
Author: Owen Rudge <owen at owenrudge.net>
Date: Mon Jul 21 19:42:07 2008 +0100
appwiz.cpl: Display Add/Remove Programs dialog.
---
dlls/appwiz.cpl/En.rc | 18 ++++++++++++
dlls/appwiz.cpl/appwiz.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/appwiz.cpl/res.h | 11 +++++++
3 files changed, 99 insertions(+), 0 deletions(-)
diff --git a/dlls/appwiz.cpl/En.rc b/dlls/appwiz.cpl/En.rc
index 240793b..ad477e3 100644
--- a/dlls/appwiz.cpl/En.rc
+++ b/dlls/appwiz.cpl/En.rc
@@ -27,3 +27,21 @@ STRINGTABLE
IDS_CPL_DESC, "Allows you to install new software, or remove existing software from your computer."
IDS_TAB1_TITLE, "Applications"
}
+
+/* TODO: it's best to use the constant WC_LISTVIEW instead of SysListView32 directly, but the Wine resource compiler doesn't seem to like that... */
+
+IDD_MAIN DIALOG 0, 0, 320, 220
+STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Install/Uninstall"
+FONT 8, "MS Sans Serif"
+{
+ CONTROL "To install a new program from a floppy disk, CD-ROM drive, or your hard drive, click Install.", 1000, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 40, 7, 270, 20
+ CONTROL "&Install...", IDC_INSTALL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 246, 26, 64, 14
+ CONTROL "", -1, "STATIC", SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 7, 46, 303, 1
+ CONTROL 2, 1001, "STATIC", SS_ICON | WS_CHILD | WS_VISIBLE, 7, 7, 21, 20
+ CONTROL "The following software can be automatically removed. To remove a program or to modify its installed components, select it from the list and click Add/Remove.", 1002, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 40, 57, 270, 36
+ CONTROL "", IDL_PROGRAMS, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SORTASCENDING | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 90, 303, 100
+ CONTROL "Add/&Remove...", IDC_ADDREMOVE, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 246, 198, 64, 14
+ CONTROL "&Support Info...", IDC_SUPPORT_INFO, "button", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 198, 64, 14
+ CONTROL 3, 1003, "STATIC", SS_ICON | WS_CHILD | WS_VISIBLE, 7, 57, 21, 20
+}
diff --git a/dlls/appwiz.cpl/appwiz.c b/dlls/appwiz.cpl/appwiz.c
index 76658de..fd06371 100644
--- a/dlls/appwiz.cpl/appwiz.c
+++ b/dlls/appwiz.cpl/appwiz.c
@@ -38,12 +38,16 @@
#include <wingdi.h>
#include <winreg.h>
#include <shellapi.h>
+#include <commctrl.h>
#include <cpl.h>
#include "res.h"
WINE_DEFAULT_DEBUG_CHANNEL(appwizcpl);
+/* define a maximum length for various buffers we use */
+#define MAX_STRING_LEN 1024
+
static HINSTANCE hInst;
/******************************************************************************
@@ -65,6 +69,61 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
}
/******************************************************************************
+ * Name : MainDlgProc
+ * Description: Callback procedure for main tab
+ * Parameters : hWnd - hWnd of the window
+ * msg - reason for calling function
+ * wParam - additional parameter
+ * lParam - additional parameter
+ * Returns : Dependant on message
+ */
+static BOOL CALLBACK MainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ return FALSE;
+}
+
+/******************************************************************************
+ * Name : StartApplet
+ * Description: Main routine for applet
+ * Parameters : hWnd - hWnd of the Control Panel
+ */
+static void StartApplet(HWND hWnd)
+{
+ PROPSHEETPAGEW psp;
+ PROPSHEETHEADERW psh;
+ WCHAR tab_title[MAX_STRING_LEN], app_title[MAX_STRING_LEN];
+
+ /* Load the strings we will use */
+ LoadStringW(hInst, IDS_TAB1_TITLE, tab_title, sizeof(tab_title) / sizeof(tab_title[0]));
+ LoadStringW(hInst, IDS_CPL_TITLE, app_title, sizeof(app_title) / sizeof(app_title[0]));
+
+ /* Fill out the PROPSHEETPAGE */
+ psp.dwSize = sizeof (PROPSHEETPAGEW);
+ psp.dwFlags = PSP_USETITLE;
+ psp.hInstance = hInst;
+ psp.pszTemplate = MAKEINTRESOURCEW (IDD_MAIN);
+ psp.pszIcon = NULL;
+ psp.pfnDlgProc = (DLGPROC) MainDlgProc;
+ psp.pszTitle = tab_title;
+ psp.lParam = 0;
+
+ /* Fill out the PROPSHEETHEADER */
+ psh.dwSize = sizeof (PROPSHEETHEADERW);
+ psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID;
+ psh.hwndParent = hWnd;
+ psh.hInstance = hInst;
+ psh.pszIcon = NULL;
+ psh.pszCaption = app_title;
+ psh.nPages = 1;
+ psh.ppsp = &psp;
+ psh.pfnCallback = NULL;
+ psh.nStartPage = 0;
+
+ /* Display the property sheet */
+ PropertySheetW (&psh);
+}
+
+/******************************************************************************
* Name : CPlApplet
* Description: Entry point for Control Panel applets
* Parameters : hwndCPL - hWnd of the Control Panel
@@ -75,9 +134,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
*/
LONG CALLBACK CPlApplet(HWND hwndCPL, UINT message, LPARAM lParam1, LPARAM lParam2)
{
+ INITCOMMONCONTROLSEX iccEx;
+
switch (message)
{
case CPL_INIT:
+ iccEx.dwSize = sizeof(iccEx);
+ iccEx.dwICC = ICC_LISTVIEW_CLASSES | ICC_TAB_CLASSES;
+
+ InitCommonControlsEx(&iccEx);
+
return TRUE;
case CPL_GETCOUNT:
@@ -94,6 +160,10 @@ LONG CALLBACK CPlApplet(HWND hwndCPL, UINT message, LPARAM lParam1, LPARAM lPara
break;
}
+
+ case CPL_DBLCLK:
+ StartApplet(hwndCPL);
+ break;
}
return FALSE;
diff --git a/dlls/appwiz.cpl/res.h b/dlls/appwiz.cpl/res.h
index 513c322..ff23bcb 100644
--- a/dlls/appwiz.cpl/res.h
+++ b/dlls/appwiz.cpl/res.h
@@ -19,6 +19,17 @@
*
*/
+/* Dialogs */
+
+#define IDD_MAIN 1
+#define IDD_INFO 2
+
+/* Dialog controls */
+#define IDC_INSTALL 1010
+#define IDL_PROGRAMS 1011
+#define IDC_ADDREMOVE 1012
+#define IDC_SUPPORT_INFO 1013
+
/* Icons */
#define ICO_MAIN 1
More information about the wine-cvs
mailing list