xref: /reactos/dll/cpl/openglcfg/openglcfg.c (revision 0c324e35)
1c2c66affSColin Finck #include "openglcfg.h"
2c2c66affSColin Finck 
3c2c66affSColin Finck #include <cpl.h>
4c2c66affSColin Finck 
5c2c66affSColin Finck HINSTANCE hApplet = 0;
6c2c66affSColin Finck 
7bd55105cSKatayama Hirofumi MZ static int CALLBACK
PropSheetProc(HWND hwndDlg,UINT uMsg,LPARAM lParam)8bd55105cSKatayama Hirofumi MZ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
9bd55105cSKatayama Hirofumi MZ {
10bd55105cSKatayama Hirofumi MZ     // NOTE: This callback is needed to set large icon correctly.
11bd55105cSKatayama Hirofumi MZ     HICON hIcon;
12bd55105cSKatayama Hirofumi MZ     switch (uMsg)
13bd55105cSKatayama Hirofumi MZ     {
14bd55105cSKatayama Hirofumi MZ         case PSCB_INITIALIZED:
15bd55105cSKatayama Hirofumi MZ         {
16bd55105cSKatayama Hirofumi MZ             hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLICON));
17bd55105cSKatayama Hirofumi MZ             SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
18bd55105cSKatayama Hirofumi MZ             break;
19bd55105cSKatayama Hirofumi MZ         }
20bd55105cSKatayama Hirofumi MZ     }
21bd55105cSKatayama Hirofumi MZ     return 0;
22bd55105cSKatayama Hirofumi MZ }
23bd55105cSKatayama Hirofumi MZ 
AppletInit(HWND hWnd)24c2c66affSColin Finck LONG CALLBACK AppletInit(HWND hWnd)
25c2c66affSColin Finck {
26c2c66affSColin Finck     PROPSHEETPAGEW psp;
27c2c66affSColin Finck     PROPSHEETHEADERW psh;
28c2c66affSColin Finck 
29c2c66affSColin Finck     ZeroMemory(&psp, sizeof(PROPSHEETPAGE));
30c2c66affSColin Finck     psp.dwSize = sizeof(PROPSHEETPAGE);
31c2c66affSColin Finck     psp.dwFlags = PSP_DEFAULT;
32c2c66affSColin Finck     psp.hInstance = hApplet;
33c2c66affSColin Finck     psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGEGENERAL);
34c2c66affSColin Finck     psp.pfnDlgProc = GeneralPageProc;
35c2c66affSColin Finck 
36c2c66affSColin Finck     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
37c2c66affSColin Finck     psh.dwSize = sizeof(PROPSHEETHEADER);
38bd55105cSKatayama Hirofumi MZ     psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
39c2c66affSColin Finck     psh.hwndParent = hWnd;
40c2c66affSColin Finck     psh.hInstance = hApplet;
41bd55105cSKatayama Hirofumi MZ     psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
42*0c324e35SThamatip Chitpong     psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
43c2c66affSColin Finck     psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
44c2c66affSColin Finck     psh.nStartPage = 0;
45c2c66affSColin Finck     psh.ppsp = &psp;
46bd55105cSKatayama Hirofumi MZ     psh.pfnCallback = PropSheetProc;
47c2c66affSColin Finck 
48c2c66affSColin Finck     return (LONG)(PropertySheet(&psh) != -1);
49c2c66affSColin Finck }
50c2c66affSColin Finck 
CPlApplet(HWND hWnd,UINT uMsg,LPARAM lParam1,LPARAM lParam2)51c2c66affSColin Finck LONG CALLBACK CPlApplet(HWND hWnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
52c2c66affSColin Finck {
53c2c66affSColin Finck     switch (uMsg)
54c2c66affSColin Finck     {
55c2c66affSColin Finck         case CPL_INIT:
56c2c66affSColin Finck             return TRUE;
57c2c66affSColin Finck 
58c2c66affSColin Finck         case CPL_GETCOUNT:
59c2c66affSColin Finck             return 1;
60c2c66affSColin Finck 
61c2c66affSColin Finck         case CPL_INQUIRE:
62c2c66affSColin Finck             {
63c2c66affSColin Finck                 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
64c2c66affSColin Finck                 CPlInfo->lData = 0;
65c2c66affSColin Finck                 CPlInfo->idIcon = IDI_CPLICON;
66c2c66affSColin Finck                 CPlInfo->idInfo = IDS_CPLDESCRIPTION;
67c2c66affSColin Finck                 CPlInfo->idName = IDS_CPLNAME;
68c2c66affSColin Finck             }
69c2c66affSColin Finck             break;
70c2c66affSColin Finck 
71c2c66affSColin Finck         case CPL_DBLCLK:
72c2c66affSColin Finck             AppletInit(hWnd);
73c2c66affSColin Finck             break;
74c2c66affSColin Finck     }
75c2c66affSColin Finck 
76c2c66affSColin Finck     return FALSE;
77c2c66affSColin Finck }
78c2c66affSColin Finck 
79c2c66affSColin Finck 
DllMain(HINSTANCE hinstDLL,DWORD dwReason,LPVOID lpvReserved)80c2c66affSColin Finck BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
81c2c66affSColin Finck {
82c2c66affSColin Finck     UNREFERENCED_PARAMETER(lpvReserved);
83c2c66affSColin Finck 
84c2c66affSColin Finck     switch (dwReason)
85c2c66affSColin Finck     {
86c2c66affSColin Finck         case DLL_PROCESS_ATTACH:
87c2c66affSColin Finck         case DLL_THREAD_ATTACH:
88c2c66affSColin Finck             hApplet = hinstDLL;
89c2c66affSColin Finck             break;
90c2c66affSColin Finck     }
91c2c66affSColin Finck 
92c2c66affSColin Finck   return TRUE;
93c2c66affSColin Finck }
94