3 * Copyright (C) 2004 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 * PROJECT: ReactOS Sample Control Panel
22 * FILE: lib/cpl/main/main.c
23 * PURPOSE: ReactOS Main Control Panel
24 * PROGRAMMER: Eric Kohl
31 #define NUM_APPLETS (2)
34 HINSTANCE hApplet
= 0;
38 APPLET Applets
[NUM_APPLETS
] =
40 {IDC_CPLICON_1
, IDS_CPLNAME_1
, IDS_CPLDESCRIPTION_1
, MouseApplet
},
41 {IDC_CPLICON_2
, IDS_CPLNAME_2
, IDS_CPLDESCRIPTION_2
, KeyboardApplet
}
46 InitPropSheetPage(PROPSHEETHEADER
*ppsh
, WORD idDlg
, DLGPROC DlgProc
)
51 if (ppsh
->nPages
< MAX_CPL_PAGES
)
53 ZeroMemory(&psp
, sizeof(psp
));
54 psp
.dwSize
= sizeof(psp
);
55 psp
.dwFlags
= PSP_DEFAULT
;
56 psp
.hInstance
= hApplet
;
57 psp
.pszTemplate
= MAKEINTRESOURCE(idDlg
);
58 psp
.pfnDlgProc
= DlgProc
;
60 hPage
= CreatePropertySheetPage(&psp
);
63 return PropSheetAddPage(hPage
, (LPARAM
)ppsh
);
71 PropSheetAddPage(HPROPSHEETPAGE hpage
, LPARAM lParam
)
73 PROPSHEETHEADER
*ppsh
= (PROPSHEETHEADER
*)lParam
;
74 if (ppsh
!= NULL
&& ppsh
->nPages
< MAX_CPL_PAGES
)
76 ppsh
->phpage
[ppsh
->nPages
++] = hpage
;
84 /* Control Panel Callback */
86 CPlApplet(HWND hwndCpl
,
101 CPLINFO
*CPlInfo
= (CPLINFO
*)lParam2
;
102 UINT uAppIndex
= (UINT
)lParam1
;
104 CPlInfo
->lData
= lParam1
;
105 CPlInfo
->idIcon
= Applets
[uAppIndex
].idIcon
;
106 CPlInfo
->idName
= Applets
[uAppIndex
].idName
;
107 CPlInfo
->idInfo
= Applets
[uAppIndex
].idDescription
;
113 UINT uAppIndex
= (UINT
)lParam1
;
114 Applets
[uAppIndex
].AppletProc(hwndCpl
, uMsg
, lParam1
, lParam2
);
124 DllMain(HINSTANCE hinstDLL
,
128 INITCOMMONCONTROLSEX InitControls
;
129 UNREFERENCED_PARAMETER(lpReserved
);
133 case DLL_PROCESS_ATTACH
:
134 InitControls
.dwSize
= sizeof(INITCOMMONCONTROLSEX
);
135 InitControls
.dwICC
= ICC_LISTVIEW_CLASSES
| ICC_UPDOWN_CLASS
| ICC_BAR_CLASSES
;
136 InitCommonControlsEx(&InitControls
);