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 International Control Panel
22 * FILE: lib/cpl/intl/intl.c
23 * PURPOSE: Property sheet code
24 * PROGRAMMER: Eric Kohl
36 #define NUM_APPLETS (1)
39 Applet(HWND hwnd
, UINT uMsg
, LPARAM wParam
, LPARAM lParam
);
42 HINSTANCE hApplet
= 0;
44 HINF hSetupInf
= INVALID_HANDLE_VALUE
;
45 DWORD IsUnattendedSetupEnabled
= 0;
46 DWORD UnattendLCID
= 0;
50 APPLET Applets
[NUM_APPLETS
] =
52 {IDC_CPLICON
, IDS_CPLNAME
, IDS_CPLDESCRIPTION
, Applet
}
57 InitPropSheetPage(PROPSHEETPAGE
*psp
, WORD idDlg
, DLGPROC DlgProc
)
59 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
60 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
61 psp
->dwFlags
= PSP_DEFAULT
;
62 psp
->hInstance
= hApplet
;
63 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
64 psp
->pfnDlgProc
= DlgProc
;
74 lpCmdLine
= GetCommandLine();
76 lpSwitch
= _tcsstr(lpCmdLine
, _T("/f:\""));
83 len
= _tcslen(lpSwitch
);
89 if(lpSwitch
[len
-1] != _T('\"'))
94 lpSwitch
[len
-1] = _T('\0');
96 hSetupInf
= SetupOpenInfFile(&lpSwitch
[4], NULL
,
97 INF_STYLE_OLDNT
, NULL
);
99 return (hSetupInf
!= INVALID_HANDLE_VALUE
);
105 INFCONTEXT InfContext
;
108 if (!SetupFindFirstLine(hSetupInf
,
113 SetupCloseInfFile(hSetupInf
);
117 if (!SetupGetStringField(&InfContext
, 1, szBuffer
,
118 sizeof(szBuffer
) / sizeof(TCHAR
), NULL
))
120 SetupCloseInfFile(hSetupInf
);
124 UnattendLCID
= _tcstoul(szBuffer
, NULL
, 16);
125 IsUnattendedSetupEnabled
= 1;
126 SetupCloseInfFile(hSetupInf
);
130 Applet(HWND hwnd
, UINT uMsg
, LPARAM wParam
, LPARAM lParam
)
132 PROPSHEETPAGE psp
[3];
141 LoadString(hApplet
, IDS_CPLNAME
, Caption
, sizeof(Caption
) / sizeof(TCHAR
));
143 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
144 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
145 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
146 psh
.hwndParent
= hCPLWindow
;
147 psh
.hInstance
= hApplet
;
148 psh
.hIcon
= LoadIcon(hApplet
, MAKEINTRESOURCE(IDC_CPLICON
));
149 psh
.pszCaption
= Caption
;
150 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
154 InitPropSheetPage(&psp
[0], IDD_GENERALPAGE
, GeneralPageProc
);
155 InitPropSheetPage(&psp
[1], IDD_LANGUAGESPAGE
, LanguagesPageProc
);
156 InitPropSheetPage(&psp
[2], IDD_ADVANCEDPAGE
, AdvancedPageProc
);
158 return (LONG
)(PropertySheet(&psh
) != -1);
162 /* Control Panel Callback */
164 CPlApplet(HWND hwndCpl
,
179 CPLINFO
*CPlInfo
= (CPLINFO
*)lParam2
;
180 UINT uAppIndex
= (UINT
)lParam1
;
183 CPlInfo
->idIcon
= Applets
[uAppIndex
].idIcon
;
184 CPlInfo
->idName
= Applets
[uAppIndex
].idName
;
185 CPlInfo
->idInfo
= Applets
[uAppIndex
].idDescription
;
191 UINT uAppIndex
= (UINT
)lParam1
;
192 hCPLWindow
= hwndCpl
;
193 Applets
[uAppIndex
].AppletProc(hwndCpl
, uMsg
, lParam1
, lParam2
);
203 DllMain(HINSTANCE hinstDLL
,
209 case DLL_PROCESS_ATTACH
:
210 case DLL_THREAD_ATTACH
: