inetcpl.cpl: Update Korean resource.
[wine] / dlls / inetcpl.cpl / inetcpl.c
1 /*
2  * Internet control panel applet
3  *
4  * Copyright 2010 Detlef Riekenberg
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  */
21
22 #define NONAMELESSUNION
23
24 #include <stdarg.h>
25 #include <windef.h>
26 #include <winbase.h>
27 #include <wingdi.h>
28 #include <winuser.h>
29 #include <commctrl.h>
30 #include <cpl.h>
31
32 #include "wine/debug.h"
33
34 #include "inetcpl.h"
35
36
37 WINE_DEFAULT_DEBUG_CHANNEL(inetcpl);
38
39 HMODULE hcpl;
40
41 /*********************************************************************
42  *  DllMain (inetcpl.@)
43  */
44 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
45 {
46     TRACE("(%p, %d, %p)\n", hdll, reason, reserved);
47
48     switch (reason)
49     {
50         case DLL_WINE_PREATTACH:
51             return FALSE;  /* prefer native version */
52
53         case DLL_PROCESS_ATTACH:
54             DisableThreadLibraryCalls(hdll);
55             hcpl = hdll;
56     }
57     return TRUE;
58 }
59
60 /******************************************************************************
61  * propsheet_callback [internal]
62  *
63  */
64 static int CALLBACK propsheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
65 {
66
67     TRACE("(%p, 0x%08x/%d, 0x%lx)\n", hwnd, msg, msg, lparam);
68     switch (msg)
69     {
70         case PSCB_INITIALIZED:
71             SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIconW(hcpl, MAKEINTRESOURCEW(ICO_MAIN)));
72             break;
73     }
74     return 0;
75 }
76
77 /******************************************************************************
78  * display_cpl_sheets [internal]
79  *
80  * Build and display the dialog with all control panel propertysheets
81  *
82  */
83 static void display_cpl_sheets(HWND parent)
84 {
85     PROPSHEETPAGEW psp[NUM_PROPERTY_PAGES];
86     PROPSHEETHEADERW psh;
87     DWORD id = 0;
88
89     ZeroMemory(&psh, sizeof(psh));
90     ZeroMemory(psp, sizeof(psp));
91
92     /* Fill out all PROPSHEETPAGE */
93     psp[id].dwSize = sizeof (PROPSHEETPAGEW);
94     psp[id].hInstance = hcpl;
95     psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_GENERAL);
96     psp[id].pfnDlgProc = general_dlgproc;
97     id++;
98
99     psp[id].dwSize = sizeof (PROPSHEETPAGEW);
100     psp[id].hInstance = hcpl;
101     psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_CONTENT);
102     psp[id].pfnDlgProc = content_dlgproc;
103     id++;
104
105     /* Fill out the PROPSHEETHEADER */
106     psh.dwSize = sizeof (PROPSHEETHEADERW);
107     psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
108     psh.hwndParent = parent;
109     psh.hInstance = hcpl;
110     psh.u.pszIcon = MAKEINTRESOURCEW(ICO_MAIN);
111     psh.pszCaption = MAKEINTRESOURCEW(IDS_CPL_NAME);
112     psh.nPages = id;
113     psh.u3.ppsp = psp;
114     psh.pfnCallback = propsheet_callback;
115
116     /* display the dialog */
117     PropertySheetW(&psh);
118 }
119
120 /*********************************************************************
121  * CPlApplet (inetcpl.@)
122  *
123  * Control Panel entry point
124  *
125  * PARAMS
126  *  hWnd    [I] Handle for the Control Panel Window
127  *  command [I] CPL_* Command
128  *  lParam1 [I] first extra Parameter
129  *  lParam2 [I] second extra Parameter
130  *
131  * RETURNS
132  *  Depends on the command
133  *
134  */
135 LONG CALLBACK CPlApplet(HWND hWnd, UINT command, LPARAM lParam1, LPARAM lParam2)
136 {
137     TRACE("(%p, %u, 0x%lx, 0x%lx)\n", hWnd, command, lParam1, lParam2);
138
139     switch (command)
140     {
141         case CPL_INIT:
142             return TRUE;
143
144         case CPL_GETCOUNT:
145             return 1;
146
147         case CPL_INQUIRE:
148         {
149             CPLINFO *appletInfo = (CPLINFO *) lParam2;
150
151             appletInfo->idIcon = ICO_MAIN;
152             appletInfo->idName = IDS_CPL_NAME;
153             appletInfo->idInfo = IDS_CPL_INFO;
154             appletInfo->lData = 0;
155             return TRUE;
156         }
157
158         case CPL_DBLCLK:
159             display_cpl_sheets(hWnd);
160             break;
161     }
162
163     return FALSE;
164 }
165
166 /*********************************************************************
167  * LaunchInternetControlPanel (inetcpl.@)
168  *
169  * Launch the Internet Control Panel dialog
170  *
171  * PARAMS
172  *  parent  [I] Handle for the parent window
173  *
174  * RETURNS
175  *  Success: TRUE
176  *
177  * NOTES
178  *  rundll32 callable function: rundll32 inetcpl.cpl,LaunchInternetControlPanel
179  *
180  */
181 BOOL WINAPI LaunchInternetControlPanel(HWND parent)
182 {
183     display_cpl_sheets(parent);
184     return TRUE;
185 }