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
29 #define NUM_APPLETS (1)
32 Applet(HWND hwnd
, UINT uMsg
, LPARAM wParam
, LPARAM lParam
);
35 HINSTANCE hApplet
= 0;
37 HINF hSetupInf
= INVALID_HANDLE_VALUE
;
38 DWORD IsUnattendedSetupEnabled
= 0;
39 DWORD UnattendLCID
= 0;
43 APPLET Applets
[NUM_APPLETS
] =
45 {IDC_CPLICON
, IDS_CPLNAME
, IDS_CPLDESCRIPTION
, Applet
}
50 InitPropSheetPage(PROPSHEETPAGE
*psp
, WORD idDlg
, DLGPROC DlgProc
)
52 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
53 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
54 psp
->dwFlags
= PSP_DEFAULT
;
55 psp
->hInstance
= hApplet
;
56 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
57 psp
->pfnDlgProc
= DlgProc
;
67 lpCmdLine
= GetCommandLine();
69 lpSwitch
= _tcsstr(lpCmdLine
, _T("/f:\""));
76 len
= _tcslen(lpSwitch
);
82 if(lpSwitch
[len
-1] != _T('\"'))
87 lpSwitch
[len
-1] = _T('\0');
89 hSetupInf
= SetupOpenInfFile(&lpSwitch
[4], NULL
,
90 INF_STYLE_OLDNT
, NULL
);
92 return (hSetupInf
!= INVALID_HANDLE_VALUE
);
98 INFCONTEXT InfContext
;
101 if (!SetupFindFirstLine(hSetupInf
,
106 SetupCloseInfFile(hSetupInf
);
110 if (!SetupGetStringField(&InfContext
, 1, szBuffer
,
111 sizeof(szBuffer
) / sizeof(TCHAR
), NULL
))
113 SetupCloseInfFile(hSetupInf
);
117 UnattendLCID
= _tcstoul(szBuffer
, NULL
, 16);
118 IsUnattendedSetupEnabled
= 1;
119 SetupCloseInfFile(hSetupInf
);
123 Applet(HWND hwnd
, UINT uMsg
, LPARAM wParam
, LPARAM lParam
)
125 PROPSHEETPAGE psp
[3];
134 LoadString(hApplet
, IDS_CPLNAME
, Caption
, sizeof(Caption
) / sizeof(TCHAR
));
136 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
137 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
138 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
139 psh
.hwndParent
= hCPLWindow
;
140 psh
.hInstance
= hApplet
;
141 psh
.hIcon
= LoadIcon(hApplet
, MAKEINTRESOURCE(IDC_CPLICON
));
142 psh
.pszCaption
= Caption
;
143 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
147 InitPropSheetPage(&psp
[0], IDD_GENERALPAGE
, GeneralPageProc
);
148 InitPropSheetPage(&psp
[1], IDD_LANGUAGESPAGE
, LanguagesPageProc
);
149 InitPropSheetPage(&psp
[2], IDD_ADVANCEDPAGE
, AdvancedPageProc
);
151 return (LONG
)(PropertySheet(&psh
) != -1);
155 /* Control Panel Callback */
157 CPlApplet(HWND hwndCpl
,
172 CPLINFO
*CPlInfo
= (CPLINFO
*)lParam2
;
173 UINT uAppIndex
= (UINT
)lParam1
;
176 CPlInfo
->idIcon
= Applets
[uAppIndex
].idIcon
;
177 CPlInfo
->idName
= Applets
[uAppIndex
].idName
;
178 CPlInfo
->idInfo
= Applets
[uAppIndex
].idDescription
;
184 UINT uAppIndex
= (UINT
)lParam1
;
185 hCPLWindow
= hwndCpl
;
186 Applets
[uAppIndex
].AppletProc(hwndCpl
, uMsg
, lParam1
, lParam2
);
196 DllMain(HINSTANCE hinstDLL
,
202 case DLL_PROCESS_ATTACH
:
203 case DLL_THREAD_ATTACH
: