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
39 #define NUM_APPLETS (2)
42 HINSTANCE hApplet
= 0;
46 APPLET Applets
[NUM_APPLETS
] =
48 {IDC_CPLICON_1
, IDS_CPLNAME_1
, IDS_CPLDESCRIPTION_1
, MouseApplet
},
49 {IDC_CPLICON_2
, IDS_CPLNAME_2
, IDS_CPLDESCRIPTION_2
, KeyboardApplet
}
54 InitPropSheetPage(PROPSHEETHEADER
*ppsh
, WORD idDlg
, DLGPROC DlgProc
)
59 if (ppsh
->nPages
< MAX_CPL_PAGES
)
61 ZeroMemory(&psp
, sizeof(psp
));
62 psp
.dwSize
= sizeof(psp
);
63 psp
.dwFlags
= PSP_DEFAULT
;
64 psp
.hInstance
= hApplet
;
65 psp
.pszTemplate
= MAKEINTRESOURCE(idDlg
);
66 psp
.pfnDlgProc
= DlgProc
;
68 hPage
= CreatePropertySheetPage(&psp
);
71 return PropSheetAddPage(hPage
, (LPARAM
)ppsh
);
79 PropSheetAddPage(HPROPSHEETPAGE hpage
, LPARAM lParam
)
81 PROPSHEETHEADER
*ppsh
= (PROPSHEETHEADER
*)lParam
;
82 if (ppsh
!= NULL
&& ppsh
->nPages
< MAX_CPL_PAGES
)
84 ppsh
->phpage
[ppsh
->nPages
++] = hpage
;
92 /* Control Panel Callback */
94 CPlApplet(HWND hwndCpl
,
109 CPLINFO
*CPlInfo
= (CPLINFO
*)lParam2
;
110 UINT uAppIndex
= (UINT
)lParam1
;
112 CPlInfo
->lData
= lParam1
;
113 CPlInfo
->idIcon
= Applets
[uAppIndex
].idIcon
;
114 CPlInfo
->idName
= Applets
[uAppIndex
].idName
;
115 CPlInfo
->idInfo
= Applets
[uAppIndex
].idDescription
;
121 UINT uAppIndex
= (UINT
)lParam1
;
122 Applets
[uAppIndex
].AppletProc(hwndCpl
, uMsg
, lParam1
, lParam2
);
132 DllMain(HINSTANCE hinstDLL
,
136 INITCOMMONCONTROLSEX InitControls
;
137 UNREFERENCED_PARAMETER(lpReserved
);
141 case DLL_PROCESS_ATTACH
:
142 InitControls
.dwSize
= sizeof(INITCOMMONCONTROLSEX
);
143 InitControls
.dwICC
= ICC_LISTVIEW_CLASSES
| ICC_UPDOWN_CLASS
| ICC_BAR_CLASSES
;
144 InitCommonControlsEx(&InitControls
);