Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmain.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS 00003 * Copyright (C) 2004 ReactOS Team 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 /* $Id: main.c 54535 2011-11-29 14:55:58Z dgorbachev $ 00020 * 00021 * PROJECT: ReactOS Sample Control Panel 00022 * FILE: dll/cpl/main/main.c 00023 * PURPOSE: ReactOS Main Control Panel 00024 * PROGRAMMER: Eric Kohl 00025 * UPDATE HISTORY: 00026 * 05-01-2004 Created 00027 */ 00028 00029 #include "main.h" 00030 00031 #define NUM_APPLETS (2) 00032 00033 00034 HINSTANCE hApplet = 0; 00035 00036 00037 /* Applets */ 00038 APPLET Applets[NUM_APPLETS] = 00039 { 00040 {IDC_CPLICON_1, IDS_CPLNAME_1, IDS_CPLDESCRIPTION_1, MouseApplet}, 00041 {IDC_CPLICON_2, IDS_CPLNAME_2, IDS_CPLDESCRIPTION_2, KeyboardApplet} 00042 }; 00043 00044 00045 BOOL 00046 InitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc) 00047 { 00048 HPROPSHEETPAGE hPage; 00049 PROPSHEETPAGE psp; 00050 00051 if (ppsh->nPages < MAX_CPL_PAGES) 00052 { 00053 ZeroMemory(&psp, sizeof(psp)); 00054 psp.dwSize = sizeof(psp); 00055 psp.dwFlags = PSP_DEFAULT; 00056 psp.hInstance = hApplet; 00057 psp.pszTemplate = MAKEINTRESOURCE(idDlg); 00058 psp.pfnDlgProc = DlgProc; 00059 00060 hPage = CreatePropertySheetPage(&psp); 00061 if (hPage != NULL) 00062 { 00063 return PropSheetAddPage(hPage, (LPARAM)ppsh); 00064 } 00065 } 00066 00067 return FALSE; 00068 } 00069 00070 BOOL CALLBACK 00071 PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam) 00072 { 00073 PROPSHEETHEADER *ppsh = (PROPSHEETHEADER *)lParam; 00074 if (ppsh != NULL && ppsh->nPages < MAX_CPL_PAGES) 00075 { 00076 ppsh->phpage[ppsh->nPages++] = hpage; 00077 return TRUE; 00078 } 00079 00080 return FALSE; 00081 } 00082 00083 00084 /* Control Panel Callback */ 00085 LONG CALLBACK 00086 CPlApplet(HWND hwndCpl, 00087 UINT uMsg, 00088 LPARAM lParam1, 00089 LPARAM lParam2) 00090 { 00091 switch(uMsg) 00092 { 00093 case CPL_INIT: 00094 return TRUE; 00095 00096 case CPL_GETCOUNT: 00097 return NUM_APPLETS; 00098 00099 case CPL_INQUIRE: 00100 { 00101 CPLINFO *CPlInfo = (CPLINFO*)lParam2; 00102 UINT uAppIndex = (UINT)lParam1; 00103 00104 CPlInfo->lData = lParam1; 00105 CPlInfo->idIcon = Applets[uAppIndex].idIcon; 00106 CPlInfo->idName = Applets[uAppIndex].idName; 00107 CPlInfo->idInfo = Applets[uAppIndex].idDescription; 00108 break; 00109 } 00110 00111 case CPL_DBLCLK: 00112 { 00113 UINT uAppIndex = (UINT)lParam1; 00114 Applets[uAppIndex].AppletProc(hwndCpl, uMsg, lParam1, lParam2); 00115 break; 00116 } 00117 } 00118 00119 return FALSE; 00120 } 00121 00122 00123 BOOL WINAPI 00124 DllMain(HINSTANCE hinstDLL, 00125 DWORD dwReason, 00126 LPVOID lpReserved) 00127 { 00128 INITCOMMONCONTROLSEX InitControls; 00129 UNREFERENCED_PARAMETER(lpReserved); 00130 00131 switch(dwReason) 00132 { 00133 case DLL_PROCESS_ATTACH: 00134 InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX); 00135 InitControls.dwICC = ICC_LISTVIEW_CLASSES | ICC_UPDOWN_CLASS | ICC_BAR_CLASSES; 00136 InitCommonControlsEx(&InitControls); 00137 00138 hApplet = hinstDLL; 00139 break; 00140 } 00141 00142 return TRUE; 00143 } Generated on Sun May 27 2012 04:16:38 for ReactOS by
1.7.6.1
|