2 * WineCfg main entry point
4 * Copyright 2002 Jaco Greeff
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2003 Mike Hearn
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define WIN32_LEAN_AND_MEAN
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
32 #include <wine/debug.h>
37 WINE_DEFAULT_DEBUG_CHANNEL(winecfg
);
40 PropSheetCallback (HWND hWnd
, UINT uMsg
, LPARAM lParam
)
45 * hWnd = NULL, lParam == dialog resource
50 case PSCB_INITIALIZED
:
59 static INT_PTR CALLBACK
60 AboutDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
65 if (((LPNMHDR
)lParam
)->code
!= PSN_SETACTIVE
) break;
66 /* otherwise fall through, we want to refresh the page as well */
80 #define NUM_PROPERTY_PAGES 7
83 doPropertySheet (HINSTANCE hInstance
, HWND hOwner
)
85 PROPSHEETPAGEW psp
[NUM_PROPERTY_PAGES
];
87 int pg
= 0; /* start with page 0 */
90 * Fill out the (Applications) PROPSHEETPAGE data structure
91 * for the property sheet
93 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
94 psp
[pg
].dwFlags
= PSP_USETITLE
;
95 psp
[pg
].hInstance
= hInstance
;
96 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_APPCFG
);
97 psp
[pg
].u2
.pszIcon
= NULL
;
98 psp
[pg
].pfnDlgProc
= AppDlgProc
;
99 psp
[pg
].pszTitle
= load_string (IDS_TAB_APPLICATIONS
);
104 * Fill out the (Libraries) PROPSHEETPAGE data structure
105 * for the property sheet
107 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
108 psp
[pg
].dwFlags
= PSP_USETITLE
;
109 psp
[pg
].hInstance
= hInstance
;
110 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_DLLCFG
);
111 psp
[pg
].u2
.pszIcon
= NULL
;
112 psp
[pg
].pfnDlgProc
= LibrariesDlgProc
;
113 psp
[pg
].pszTitle
= load_string (IDS_TAB_DLLS
);
118 * Fill out the (X11Drv) PROPSHEETPAGE data structure
119 * for the property sheet
121 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
122 psp
[pg
].dwFlags
= PSP_USETITLE
;
123 psp
[pg
].hInstance
= hInstance
;
124 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_GRAPHCFG
);
125 psp
[pg
].u2
.pszIcon
= NULL
;
126 psp
[pg
].pfnDlgProc
= GraphDlgProc
;
127 psp
[pg
].pszTitle
= load_string (IDS_TAB_GRAPHICS
);
131 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
132 psp
[pg
].dwFlags
= PSP_USETITLE
;
133 psp
[pg
].hInstance
= hInstance
;
134 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_DESKTOP_INTEGRATION
);
135 psp
[pg
].u2
.pszIcon
= NULL
;
136 psp
[pg
].pfnDlgProc
= ThemeDlgProc
;
137 psp
[pg
].pszTitle
= load_string (IDS_TAB_DESKTOP_INTEGRATION
);
141 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
142 psp
[pg
].dwFlags
= PSP_USETITLE
;
143 psp
[pg
].hInstance
= hInstance
;
144 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_DRIVECFG
);
145 psp
[pg
].u2
.pszIcon
= NULL
;
146 psp
[pg
].pfnDlgProc
= DriveDlgProc
;
147 psp
[pg
].pszTitle
= load_string (IDS_TAB_DRIVES
);
151 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
152 psp
[pg
].dwFlags
= PSP_USETITLE
;
153 psp
[pg
].hInstance
= hInstance
;
154 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_AUDIOCFG
);
155 psp
[pg
].u2
.pszIcon
= NULL
;
156 psp
[pg
].pfnDlgProc
= AudioDlgProc
;
157 psp
[pg
].pszTitle
= load_string (IDS_TAB_AUDIO
);
162 * Fill out the (General) PROPSHEETPAGE data structure
163 * for the property sheet
165 psp
[pg
].dwSize
= sizeof (PROPSHEETPAGEW
);
166 psp
[pg
].dwFlags
= PSP_USETITLE
;
167 psp
[pg
].hInstance
= hInstance
;
168 psp
[pg
].u
.pszTemplate
= MAKEINTRESOURCEW (IDD_ABOUTCFG
);
169 psp
[pg
].u2
.pszIcon
= NULL
;
170 psp
[pg
].pfnDlgProc
= AboutDlgProc
;
171 psp
[pg
].pszTitle
= load_string (IDS_TAB_ABOUT
);
176 * Fill out the PROPSHEETHEADER
178 psh
.dwSize
= sizeof (PROPSHEETHEADERW
);
179 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_USEICONID
| PSH_USECALLBACK
;
180 psh
.hwndParent
= hOwner
;
181 psh
.hInstance
= hInstance
;
182 psh
.u
.pszIcon
= NULL
;
183 psh
.pszCaption
= load_string (IDS_WINECFG_TITLE
);
184 psh
.nPages
= NUM_PROPERTY_PAGES
;
186 psh
.pfnCallback
= PropSheetCallback
;
187 psh
.u2
.nStartPage
= 0;
190 * Display the modal property sheet
192 return PropertySheetW (&psh
);
195 /******************************************************************************
196 * Name : ProcessCmdLine
197 * Description: Checks command line parameters for 'autodetect drives' option
198 * Parameters : lpCmdLine - the command line
199 * Returns : TRUE - if '/D' was found. Drive autodetection was carried out.
200 * FALSE - no '/D' option found in command line
201 * Notes : This is a very simple implementation, which only works
202 * correctly if the one and only cmd line option is '/D' or
203 * no option at all. Has to be reworked, if more options are to
207 ProcessCmdLine(LPSTR lpCmdLine
)
209 if ((lpCmdLine
[0] == '/' || lpCmdLine
[0] == '-') &&
210 (lpCmdLine
[1] == 'D' || lpCmdLine
[1] == 'd'))
213 if (autodetect_drives()) {
214 apply_drive_changes();
222 /*****************************************************************************
224 * Description: Main windows entry point
225 * Parameters : hInstance
229 * Returns : Program exit code
232 WinMain (HINSTANCE hInstance
, HINSTANCE hPrev
, LPSTR szCmdLine
, int nShow
)
234 if (ProcessCmdLine(szCmdLine
)) {
238 if (initialize(hInstance
) != 0) {
239 WINE_ERR("initialization failed, aborting\n");
244 * The next 9 lines should be all that is needed
245 * for the Wine Configuration property sheet
247 InitCommonControls ();
248 CoInitializeEx(NULL
, COINIT_APARTMENTTHREADED
);
249 if (doPropertySheet (hInstance
, NULL
) > 0) {
252 WINE_TRACE("Cancel\n");