Fixed definition of MAX_COMPUTERNAME_LENGTH (spotted by Mike
[wine/multimedia.git] / programs / winecfg / main.c
blob6277dad2d0fb26817ec72133bdfe1d598d7a74c3
1 /*
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "config.h"
26 #include <stdlib.h>
27 #include <stdio.h>
28 #include <stdarg.h>
29 #ifdef HAVE_UNISTD_H
30 #include <unistd.h>
31 #endif
33 #define NONAMELESSUNION
34 #define NONAMELESSSTRUCT
36 #include <windef.h>
37 #include <winbase.h>
38 #include <winuser.h>
39 #include <commctrl.h>
40 #include <wine/debug.h>
42 #include "properties.h"
43 #include "resource.h"
44 #include "winecfg.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
48 void CALLBACK
49 PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
51 switch (uMsg)
54 * hWnd = NULL, lParam == dialog resource
56 case PSCB_PRECREATE:
57 break;
59 case PSCB_INITIALIZED:
60 break;
62 default:
63 break;
67 INT_PTR CALLBACK
68 AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
70 switch (uMsg) {
72 case WM_NOTIFY:
73 if (((LPNMHDR)lParam)->code != PSN_SETACTIVE) break;
74 /* otherwise fall through, we want to refresh the page as well */
75 case WM_INITDIALOG:
76 break;
78 case WM_COMMAND:
79 break;
81 default:
82 break;
85 return FALSE;
88 #define NUM_PROPERTY_PAGES 6
90 INT_PTR
91 doPropertySheet (HINSTANCE hInstance, HWND hOwner)
93 PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
94 PROPSHEETHEADER psh;
95 int pg = 0; /* start with page 0 */
98 * Fill out the (Applications) PROPSHEETPAGE data structure
99 * for the property sheet
101 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
102 psp[pg].dwFlags = PSP_USETITLE;
103 psp[pg].hInstance = hInstance;
104 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_APPCFG);
105 psp[pg].u2.pszIcon = NULL;
106 psp[pg].pfnDlgProc = AppDlgProc;
107 psp[pg].pszTitle = "Applications";
108 psp[pg].lParam = 0;
109 pg++;
112 * Fill out the (Libraries) PROPSHEETPAGE data structure
113 * for the property sheet
115 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
116 psp[pg].dwFlags = PSP_USETITLE;
117 psp[pg].hInstance = hInstance;
118 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DLLCFG);
119 psp[pg].u2.pszIcon = NULL;
120 psp[pg].pfnDlgProc = LibrariesDlgProc;
121 psp[pg].pszTitle = "Libraries";
122 psp[pg].lParam = 0;
123 pg++;
126 * Fill out the (X11Drv) PROPSHEETPAGE data structure
127 * for the property sheet
129 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
130 psp[pg].dwFlags = PSP_USETITLE;
131 psp[pg].hInstance = hInstance;
132 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_GRAPHCFG);
133 psp[pg].u2.pszIcon = NULL;
134 psp[pg].pfnDlgProc = GraphDlgProc;
135 psp[pg].pszTitle = "Graphics";
136 psp[pg].lParam = 0;
137 pg++;
139 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
140 psp[pg].dwFlags = PSP_USETITLE;
141 psp[pg].hInstance = hInstance;
142 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_DRIVECFG);
143 psp[pg].u2.pszIcon = NULL;
144 psp[pg].pfnDlgProc = DriveDlgProc;
145 psp[pg].pszTitle = "Drives";
146 psp[pg].lParam = 0;
147 pg++;
149 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
150 psp[pg].dwFlags = PSP_USETITLE;
151 psp[pg].hInstance = hInstance;
152 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_AUDIOCFG);
153 psp[pg].u2.pszIcon = NULL;
154 psp[pg].pfnDlgProc = AudioDlgProc;
155 psp[pg].pszTitle = "Audio";
156 psp[pg].lParam = 0;
157 pg++;
160 * Fill out the (General) PROPSHEETPAGE data structure
161 * for the property sheet
163 psp[pg].dwSize = sizeof (PROPSHEETPAGE);
164 psp[pg].dwFlags = PSP_USETITLE;
165 psp[pg].hInstance = hInstance;
166 psp[pg].u.pszTemplate = MAKEINTRESOURCE (IDD_ABOUTCFG);
167 psp[pg].u2.pszIcon = NULL;
168 psp[pg].pfnDlgProc = AboutDlgProc;
169 psp[pg].pszTitle = "About";
170 psp[pg].lParam = 0;
171 pg++;
174 * Fill out the PROPSHEETHEADER
176 psh.dwSize = sizeof (PROPSHEETHEADER);
177 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
178 psh.hwndParent = hOwner;
179 psh.hInstance = hInstance;
180 psh.u.pszIcon = NULL;
181 psh.pszCaption = "Wine Configuration";
182 psh.nPages = NUM_PROPERTY_PAGES;
183 psh.u3.ppsp = (LPCPROPSHEETPAGE) & psp;
184 psh.pfnCallback = (PFNPROPSHEETCALLBACK) PropSheetCallback;
185 psh.u2.nStartPage = 0;
188 * Display the modal property sheet
190 return PropertySheet (&psh);
194 /*****************************************************************************
195 * Name : WinMain
196 * Description: Main windows entry point
197 * Parameters : hInstance
198 * hPrev
199 * szCmdLine
200 * nShow
201 * Returns : Program exit code
203 int WINAPI
204 WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
207 /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
208 if (!getenv("WINECFG_NOWARN")) {
209 WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
210 WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
211 MessageBoxA(NULL, "The winecfg tool is not yet complete, and does not actually alter your configuration\n\n"
212 "If you want to alter the way Wine works, look in the ~/.wine/config file for more information.",
213 "", MB_OK | MB_ICONEXCLAMATION);
216 if (initialize() != 0) {
217 WINE_ERR("initialization failed, aborting\n");
218 ExitProcess(1);
222 * The next 3 lines should be all that is needed
223 * for the Wine Configuration property sheet
225 InitCommonControls ();
226 if (doPropertySheet (hInstance, NULL) > 0) {
227 WINE_TRACE("OK\n");
228 } else {
229 WINE_TRACE("Cancel\n");
232 ExitProcess (0);
234 return 0;