ntdll: Add Windows 11 version.
[wine.git] / programs / winecfg / appdefaults.c
blob3f6b424fed602f14cd06083e0abc867cc1d68937
1 /*
2 * WineCfg app settings tabsheet
4 * Copyright 2004 Robert van Herk
5 * Copyright 2004 Chris Morgan
6 * Copyright 2004 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
25 #include <windows.h>
26 #include <commdlg.h>
27 #include <wine/debug.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <assert.h>
31 #include "winecfg.h"
32 #include "resource.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
36 struct win_version
38 const WCHAR *szVersion;
39 const WCHAR *szDescription;
40 DWORD dwMajorVersion;
41 DWORD dwMinorVersion;
42 DWORD dwBuildNumber;
43 DWORD dwPlatformId;
44 const WCHAR *szCSDVersion;
45 WORD wServicePackMajor;
46 WORD wServicePackMinor;
47 const WCHAR *szProductType;
50 static const struct win_version win_versions[] =
52 { L"win11", L"Windows 11", 10, 0, 22000, VER_PLATFORM_WIN32_NT, L"", 0, 0, L"WinNT"},
53 { L"win10", L"Windows 10", 10, 0, 18362, VER_PLATFORM_WIN32_NT, L"", 0, 0, L"WinNT"},
54 { L"win81", L"Windows 8.1", 6, 3, 9600, VER_PLATFORM_WIN32_NT, L"", 0, 0, L"WinNT"},
55 { L"win8", L"Windows 8", 6, 2, 9200, VER_PLATFORM_WIN32_NT, L"", 0, 0, L"WinNT"},
56 { L"win2008r2", L"Windows 2008 R2", 6, 1, 7601, VER_PLATFORM_WIN32_NT, L"Service Pack 1", 1, 0, L"ServerNT"},
57 { L"win7", L"Windows 7", 6, 1, 7601, VER_PLATFORM_WIN32_NT, L"Service Pack 1", 1, 0, L"WinNT"},
58 { L"win2008", L"Windows 2008", 6, 0, 6002, VER_PLATFORM_WIN32_NT, L"Service Pack 2", 2, 0, L"ServerNT"},
59 { L"vista", L"Windows Vista", 6, 0, 6002, VER_PLATFORM_WIN32_NT, L"Service Pack 2", 2, 0, L"WinNT"},
60 { L"win2003", L"Windows 2003", 5, 2, 3790, VER_PLATFORM_WIN32_NT, L"Service Pack 2", 2, 0, L"ServerNT"},
61 #ifdef _WIN64
62 { L"winxp64", L"Windows XP", 5, 2, 3790, VER_PLATFORM_WIN32_NT, L"Service Pack 2", 2, 0, L"WinNT"},
63 #else
64 { L"winxp", L"Windows XP", 5, 1, 2600, VER_PLATFORM_WIN32_NT, L"Service Pack 3", 3, 0, L"WinNT"},
65 { L"win2k", L"Windows 2000", 5, 0, 2195, VER_PLATFORM_WIN32_NT, L"Service Pack 4", 4, 0, L"WinNT"},
66 { L"winme", L"Windows ME", 4, 90, 3000, VER_PLATFORM_WIN32_WINDOWS, L" ", 0, 0, L""},
67 { L"win98", L"Windows 98", 4, 10, 2222, VER_PLATFORM_WIN32_WINDOWS, L" A ", 0, 0, L""},
68 { L"win95", L"Windows 95", 4, 0, 950, VER_PLATFORM_WIN32_WINDOWS, L"", 0, 0, L""},
69 { L"nt40", L"Windows NT 4.0", 4, 0, 1381, VER_PLATFORM_WIN32_NT, L"Service Pack 6a", 6, 0, L"WinNT"},
70 { L"nt351", L"Windows NT 3.51", 3, 51, 1057, VER_PLATFORM_WIN32_NT, L"Service Pack 5", 5, 0, L"WinNT"},
71 { L"win31", L"Windows 3.1", 3, 10, 0, VER_PLATFORM_WIN32s, L"Win32s 1.3", 0, 0, L""},
72 { L"win30", L"Windows 3.0", 3, 0, 0, VER_PLATFORM_WIN32s, L"Win32s 1.3", 0, 0, L""},
73 { L"win20", L"Windows 2.0", 2, 0, 0, VER_PLATFORM_WIN32s, L"Win32s 1.3", 0, 0, L""}
74 #endif
77 #define DEFAULT_WIN_VERSION L"win7"
79 static const WCHAR szKey9x[] = L"Software\\Microsoft\\Windows\\CurrentVersion";
80 static const WCHAR szKeyNT[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion";
81 static const WCHAR szKeyProdNT[] = L"System\\CurrentControlSet\\Control\\ProductOptions";
83 static int get_registry_version(void)
85 int i, best = -1, platform, major, minor = 0, build = 0;
86 WCHAR *p, *ver, *type = NULL;
88 if ((ver = get_reg_key( HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentVersion", NULL )))
90 WCHAR *build_str;
92 platform = VER_PLATFORM_WIN32_NT;
94 build_str = get_reg_key( HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentBuildNumber", NULL );
95 build = wcstol(build_str, NULL, 10);
97 type = get_reg_key( HKEY_LOCAL_MACHINE, szKeyProdNT, L"ProductType", NULL );
99 else if ((ver = get_reg_key( HKEY_LOCAL_MACHINE, szKey9x, L"VersionNumber", NULL )))
100 platform = VER_PLATFORM_WIN32_WINDOWS;
101 else
102 return -1;
104 if ((p = wcschr( ver, '.' )))
106 WCHAR *minor_str = p;
107 *minor_str++ = 0;
108 if ((p = wcschr( minor_str, '.' )))
110 WCHAR *build_str = p;
111 *build_str++ = 0;
112 build = wcstol(build_str, NULL, 10);
114 minor = wcstol(minor_str, NULL, 10);
116 major = wcstol(ver, NULL, 10);
118 for (i = 0; i < ARRAY_SIZE(win_versions); i++)
120 if (win_versions[i].dwPlatformId != platform) continue;
121 if (win_versions[i].dwMajorVersion != major) continue;
122 if (type && wcsicmp(win_versions[i].szProductType, type)) continue;
123 best = i;
124 if ((win_versions[i].dwMinorVersion == minor) &&
125 (win_versions[i].dwBuildNumber == build))
126 return i;
128 return best;
131 static void update_comboboxes(HWND dialog)
133 int i, ver;
134 WCHAR *winver;
136 /* retrieve the registry values */
137 winver = get_reg_key(config_key, keypath(L""), L"Version", L"");
138 ver = get_registry_version();
140 if (!winver || !winver[0])
142 free(winver);
144 if (current_app) /* no explicit setting */
146 WINE_TRACE("setting winver combobox to default\n");
147 SendDlgItemMessageW(dialog, IDC_WINVER, CB_SETCURSEL, 0, 0);
148 return;
150 if (ver != -1) winver = wcsdup(win_versions[ver].szVersion);
151 else winver = wcsdup(DEFAULT_WIN_VERSION);
153 WINE_TRACE("winver is %s\n", debugstr_w(winver));
155 /* normalize the version strings */
156 for (i = 0; i < ARRAY_SIZE(win_versions); i++)
158 if (!wcsicmp(win_versions[i].szVersion, winver))
160 SendDlgItemMessageW(dialog, IDC_WINVER, CB_SETCURSEL,
161 i + (current_app?1:0), 0);
162 WINE_TRACE("match with %s\n", debugstr_w(win_versions[i].szVersion));
163 break;
167 free(winver);
170 static void
171 init_comboboxes (HWND dialog)
173 int i;
175 SendDlgItemMessageW(dialog, IDC_WINVER, CB_RESETCONTENT, 0, 0);
177 /* add the default entries (automatic) which correspond to no setting */
178 if (current_app)
180 WCHAR str[256];
181 LoadStringW(GetModuleHandleW(NULL), IDS_USE_GLOBAL_SETTINGS, str, ARRAY_SIZE(str));
182 SendDlgItemMessageW (dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM)str);
185 for (i = 0; i < ARRAY_SIZE(win_versions); i++)
187 SendDlgItemMessageW(dialog, IDC_WINVER, CB_ADDSTRING,
188 0, (LPARAM) win_versions[i].szDescription);
192 static void add_listview_item(HWND listview, WCHAR *text, void *association)
194 LVITEMW item;
196 item.mask = LVIF_TEXT | LVIF_PARAM;
197 item.pszText = text;
198 item.cchTextMax = lstrlenW(text);
199 item.lParam = (LPARAM) association;
200 item.iItem = SendMessageW( listview, LVM_GETITEMCOUNT, 0, 0 );
201 item.iSubItem = 0;
203 SendMessageW(listview, LVM_INSERTITEMW, 0, (LPARAM) &item);
206 /* Called when the application is initialized (cannot reinit!) */
207 static void init_appsheet(HWND dialog)
209 HWND listview;
210 LVITEMW item;
211 HKEY key;
212 int i;
213 DWORD size;
214 WCHAR appname[1024];
216 WINE_TRACE("()\n");
218 listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
220 /* we use the lparam field of the item so we can alter the presentation later and not change code
221 * for instance, to use the tile view or to display the EXEs embedded 'display name' */
222 LoadStringW(GetModuleHandleW(NULL), IDS_DEFAULT_SETTINGS, appname, ARRAY_SIZE(appname));
223 add_listview_item(listview, appname, NULL);
225 /* because this list is only populated once, it's safe to bypass the settings list here */
226 if (RegOpenKeyW(config_key, L"AppDefaults", &key) == ERROR_SUCCESS)
228 i = 0;
229 size = ARRAY_SIZE(appname);
230 while (RegEnumKeyExW (key, i, appname, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
232 add_listview_item(listview, appname, wcsdup(appname));
234 i++;
235 size = ARRAY_SIZE(appname);
238 RegCloseKey(key);
241 init_comboboxes(dialog);
243 /* Select the default settings listview item */
244 item.iItem = 0;
245 item.iSubItem = 0;
246 item.mask = LVIF_STATE;
247 item.state = LVIS_SELECTED | LVIS_FOCUSED;
248 item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
250 SendMessageW(listview, LVM_SETITEMW, 0, (LPARAM) &item);
253 /* there has to be an easier way than this */
254 static int get_listview_selection(HWND listview)
256 int count = SendMessageW(listview, LVM_GETITEMCOUNT, 0, 0);
257 int i;
259 for (i = 0; i < count; i++)
261 if (SendMessageW( listview, LVM_GETITEMSTATE, i, LVIS_SELECTED )) return i;
264 return -1;
268 /* called when the user selects a different application */
269 static void on_selection_change(HWND dialog, HWND listview)
271 LVITEMW item;
272 WCHAR* oldapp = current_app;
274 WINE_TRACE("()\n");
276 item.iItem = get_listview_selection(listview);
277 item.iSubItem = 0;
278 item.mask = LVIF_PARAM;
280 WINE_TRACE("item.iItem=%d\n", item.iItem);
282 if (item.iItem == -1) return;
284 SendMessageW(listview, LVM_GETITEMW, 0, (LPARAM) &item);
286 current_app = (WCHAR*) item.lParam;
288 if (current_app)
290 WINE_TRACE("current_app is now %s\n", wine_dbgstr_w (current_app));
291 enable(IDC_APP_REMOVEAPP);
293 else
295 WINE_TRACE("current_app=NULL, editing global settings\n");
296 /* focus will never be on the button in this callback so it's safe */
297 disable(IDC_APP_REMOVEAPP);
300 /* reset the combo boxes if we changed from/to global/app-specific */
302 if ((oldapp && !current_app) || (!oldapp && current_app))
303 init_comboboxes(dialog);
305 update_comboboxes(dialog);
307 set_window_title(dialog);
310 static BOOL list_contains_file(HWND listview, WCHAR *filename)
312 LVFINDINFOW find_info = { LVFI_STRING, filename, 0, {0, 0}, 0 };
313 int index;
315 index = ListView_FindItemW(listview, -1, &find_info);
317 return (index != -1);
320 static void on_add_app_click(HWND dialog)
322 WCHAR filetitle[MAX_PATH];
323 WCHAR file[MAX_PATH];
324 WCHAR programsFilter[100], filter[MAX_PATH];
325 WCHAR selectExecutableStr[100];
327 OPENFILENAMEW ofn = { sizeof(OPENFILENAMEW),
328 dialog, /*hInst*/0, 0, NULL, 0, 0, NULL,
329 0, NULL, 0, L"C:\\", 0,
330 OFN_SHOWHELP | OFN_HIDEREADONLY | OFN_ENABLESIZING,
331 0, 0, NULL, 0, NULL };
333 LoadStringW (GetModuleHandleW(NULL), IDS_SELECT_EXECUTABLE, selectExecutableStr,
334 ARRAY_SIZE(selectExecutableStr));
335 LoadStringW (GetModuleHandleW(NULL), IDS_EXECUTABLE_FILTER, programsFilter,
336 ARRAY_SIZE(programsFilter));
337 swprintf( filter, MAX_PATH, L"%s%c*.exe;*.exe.so%c", programsFilter, 0, 0 );
339 ofn.lpstrTitle = selectExecutableStr;
340 ofn.lpstrFilter = filter;
341 ofn.lpstrFileTitle = filetitle;
342 ofn.lpstrFileTitle[0] = '\0';
343 ofn.nMaxFileTitle = ARRAY_SIZE(filetitle);
344 ofn.lpstrFile = file;
345 ofn.lpstrFile[0] = '\0';
346 ofn.nMaxFile = ARRAY_SIZE(file);
348 if (GetOpenFileNameW (&ofn))
350 HWND listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
351 int count = SendMessageW(listview, LVM_GETITEMCOUNT, 0, 0);
352 WCHAR* new_app;
353 LVITEMW item;
355 if (list_contains_file(listview, filetitle))
356 return;
358 new_app = wcsdup(filetitle);
360 WINE_TRACE("adding %s\n", wine_dbgstr_w (new_app));
362 add_listview_item(listview, new_app, new_app);
364 item.mask = LVIF_STATE;
365 item.state = LVIS_SELECTED | LVIS_FOCUSED;
366 item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
367 SendMessageW(listview, LVM_SETITEMSTATE, count, (LPARAM)&item );
369 SetFocus(listview);
371 else WINE_TRACE("user cancelled\n");
374 static void on_remove_app_click(HWND dialog)
376 HWND listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
377 int selection = get_listview_selection(listview);
378 LVITEMW item;
380 item.iItem = selection;
381 item.iSubItem = 0;
382 item.mask = LVIF_PARAM;
384 WINE_TRACE("selection=%d\n", selection);
386 assert( selection != 0 ); /* user cannot click this button when "default settings" is selected */
388 set_reg_key(config_key, keypath(L""), NULL, NULL); /* delete the section */
389 SendMessageW(listview, LVM_GETITEMW, 0, (LPARAM) &item);
390 free((void*)item.lParam);
391 SendMessageW(listview, LVM_DELETEITEM, selection, 0);
392 item.mask = LVIF_STATE;
393 item.state = LVIS_SELECTED | LVIS_FOCUSED;
394 item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
395 SendMessageW(listview, LVM_SETITEMSTATE, 0, (LPARAM)&item);
397 SetFocus(listview);
398 SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
401 static void set_winver(const struct win_version *version)
403 static const WCHAR szKeyWindNT[] = L"System\\CurrentControlSet\\Control\\Windows";
404 static const WCHAR szKeyEnvNT[] = L"System\\CurrentControlSet\\Control\\Session Manager\\Environment";
405 WCHAR buffer[40];
407 switch (version->dwPlatformId)
409 case VER_PLATFORM_WIN32_WINDOWS:
410 swprintf(buffer, ARRAY_SIZE(buffer), L"%d.%d.%d", version->dwMajorVersion,
411 version->dwMinorVersion, version->dwBuildNumber);
412 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"VersionNumber", buffer);
413 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"SubVersionNumber", version->szCSDVersion);
414 swprintf(buffer, ARRAY_SIZE(buffer), L"Microsoft %s", version->szDescription);
415 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"ProductName", buffer);
417 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CSDVersion", NULL);
418 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentVersion", NULL);
419 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentMajorVersionNumber", NULL);
420 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentMinorVersionNumber", NULL);
421 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentBuild", NULL);
422 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentBuildNumber", NULL);
423 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"ProductName", NULL);
424 set_reg_key(HKEY_LOCAL_MACHINE, szKeyProdNT, L"ProductType", NULL);
425 set_reg_key(HKEY_LOCAL_MACHINE, szKeyWindNT, L"CSDVersion", NULL);
426 set_reg_key(HKEY_LOCAL_MACHINE, szKeyEnvNT, L"OS", NULL);
427 set_reg_key(config_key, keypath(L""), L"Version", NULL);
428 break;
430 case VER_PLATFORM_WIN32_NT:
431 swprintf(buffer, ARRAY_SIZE(buffer), L"%d.%d", version->dwMajorVersion,
432 version->dwMinorVersion);
433 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentVersion", buffer);
434 set_reg_key_dword(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentMajorVersionNumber", version->dwMajorVersion);
435 set_reg_key_dword(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentMinorVersionNumber", version->dwMinorVersion);
436 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CSDVersion", version->szCSDVersion);
437 swprintf(buffer, ARRAY_SIZE(buffer), L"%d", version->dwBuildNumber);
438 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentBuild", buffer);
439 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentBuildNumber", buffer);
440 swprintf(buffer, ARRAY_SIZE(buffer), L"Microsoft %s", version->szDescription);
441 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"ProductName", buffer);
442 set_reg_key(HKEY_LOCAL_MACHINE, szKeyProdNT, L"ProductType", version->szProductType);
443 set_reg_key_dword(HKEY_LOCAL_MACHINE, szKeyWindNT, L"CSDVersion",
444 MAKEWORD( version->wServicePackMinor,
445 version->wServicePackMajor ));
446 set_reg_key(HKEY_LOCAL_MACHINE, szKeyEnvNT, L"OS", L"Windows_NT");
448 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"VersionNumber", NULL);
449 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"SubVersionNumber", NULL);
450 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"ProductName", NULL);
451 set_reg_key(config_key, keypath(L""), L"Version", NULL);
452 break;
454 case VER_PLATFORM_WIN32s:
455 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CSDVersion", NULL);
456 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentVersion", NULL);
457 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentBuild", NULL);
458 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"CurrentBuildNumber", NULL);
459 set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, L"ProductName", NULL);
460 set_reg_key(HKEY_LOCAL_MACHINE, szKeyProdNT, L"ProductType", NULL);
461 set_reg_key(HKEY_LOCAL_MACHINE, szKeyWindNT, L"CSDVersion", NULL);
462 set_reg_key(HKEY_LOCAL_MACHINE, szKeyEnvNT, L"OS", NULL);
463 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"VersionNumber", NULL);
464 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"SubVersionNumber", NULL);
465 set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, L"ProductName", NULL);
466 set_reg_key(config_key, keypath(L""), L"Version", version->szVersion);
467 break;
471 BOOL set_winver_from_string(const WCHAR *version)
473 int i;
475 WINE_TRACE("desired winver: %s\n", debugstr_w(version));
477 for (i = 0; i < ARRAY_SIZE(win_versions); i++)
479 if (!wcsicmp(win_versions[i].szVersion, version))
481 WINE_TRACE("match with %s\n", debugstr_w(win_versions[i].szVersion));
482 set_winver(&win_versions[i]);
483 apply();
484 return TRUE;
488 return FALSE;
491 void print_windows_versions(void)
493 int i;
495 for (i = 0; i < ARRAY_SIZE(win_versions); i++)
497 wprintf(L" %10s %s\n", win_versions[i].szVersion, win_versions[i].szDescription);
501 void print_current_winver(void)
503 WCHAR *winver = get_reg_key(config_key, keypath(L""), L"Version", L"");
505 if (!winver || !winver[0])
507 int ver = get_registry_version();
508 wprintf(L"%s\n", ver == -1 ? DEFAULT_WIN_VERSION : win_versions[ver].szVersion);
510 else
511 wprintf(L"%s\n", winver);
513 free(winver);
516 static void on_winver_change(HWND dialog)
518 int selection = SendDlgItemMessageW(dialog, IDC_WINVER, CB_GETCURSEL, 0, 0);
520 if (current_app)
522 if (!selection)
524 WINE_TRACE("default selected so removing current setting\n");
525 set_reg_key(config_key, keypath(L""), L"Version", NULL);
527 else
529 WINE_TRACE("setting Version key to value %s\n", debugstr_w(win_versions[selection-1].szVersion));
530 set_reg_key(config_key, keypath(L""), L"Version", win_versions[selection-1].szVersion);
533 else /* global version only */
535 set_winver(&win_versions[selection]);
538 /* enable the apply button */
539 SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
542 INT_PTR CALLBACK
543 AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
545 switch (uMsg)
547 case WM_INITDIALOG:
548 init_appsheet(hDlg);
549 break;
551 case WM_SHOWWINDOW:
552 set_window_title(hDlg);
553 break;
555 case WM_NOTIFY:
556 switch (((LPNMHDR)lParam)->code)
558 case LVN_ITEMCHANGED:
559 on_selection_change(hDlg, GetDlgItem(hDlg, IDC_APP_LISTVIEW));
560 break;
561 case PSN_APPLY:
562 apply();
563 SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
564 break;
567 break;
569 case WM_COMMAND:
570 switch(HIWORD(wParam))
572 case CBN_SELCHANGE:
573 switch(LOWORD(wParam))
575 case IDC_WINVER:
576 on_winver_change(hDlg);
577 break;
579 case BN_CLICKED:
580 switch(LOWORD(wParam))
582 case IDC_APP_ADDAPP:
583 on_add_app_click(hDlg);
584 break;
585 case IDC_APP_REMOVEAPP:
586 on_remove_app_click(hDlg);
587 break;
589 break;
592 break;
595 return 0;