widl: Add support for protected attribute.
[wine.git] / dlls / inetcpl.cpl / inetcpl.c
bloba2feccb3eb179e1a02dd230cea191fb3afef22bd
1 /*
2 * Internet control panel applet
4 * Copyright 2010 Detlef Riekenberg
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.
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.
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
22 #define NONAMELESSUNION
23 #define COBJMACROS
24 #define CONST_VTABLE
26 #include <stdarg.h>
27 #include <windef.h>
28 #include <winbase.h>
29 #include <wingdi.h>
30 #include <winuser.h>
31 #include <commctrl.h>
32 #include <cpl.h>
33 #include "ole2.h"
35 #include "wine/debug.h"
37 #include "inetcpl.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(inetcpl);
42 DECLSPEC_HIDDEN HMODULE hcpl;
44 /*********************************************************************
45 * DllMain (inetcpl.@)
47 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
49 TRACE("(%p, %ld, %p)\n", hdll, reason, reserved);
51 switch (reason)
53 case DLL_PROCESS_ATTACH:
54 DisableThreadLibraryCalls(hdll);
55 hcpl = hdll;
57 return TRUE;
60 /***********************************************************************
61 * DllInstall (inetcpl.@)
63 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
65 FIXME("(%s, %s): stub\n", bInstall ? "TRUE" : "FALSE", debugstr_w(cmdline));
66 return S_OK;
69 /******************************************************************************
70 * propsheet_callback [internal]
73 static int CALLBACK propsheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
76 TRACE("(%p, 0x%08x/%d, 0x%Ix)\n", hwnd, msg, msg, lparam);
77 switch (msg)
79 case PSCB_INITIALIZED:
80 SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIconW(hcpl, MAKEINTRESOURCEW(ICO_MAIN)));
81 break;
83 return 0;
86 /******************************************************************************
87 * display_cpl_sheets [internal]
89 * Build and display the dialog with all control panel propertysheets
92 static void display_cpl_sheets(HWND parent)
94 INITCOMMONCONTROLSEX icex;
95 PROPSHEETPAGEW psp[NUM_PROPERTY_PAGES];
96 PROPSHEETHEADERW psh;
97 DWORD id = 0;
99 OleInitialize(NULL);
100 /* Initialize common controls */
101 icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
102 icex.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES;
103 InitCommonControlsEx(&icex);
105 ZeroMemory(&psh, sizeof(psh));
106 ZeroMemory(psp, sizeof(psp));
108 /* Fill out all PROPSHEETPAGE */
109 psp[id].dwSize = sizeof (PROPSHEETPAGEW);
110 psp[id].hInstance = hcpl;
111 psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_GENERAL);
112 psp[id].pfnDlgProc = general_dlgproc;
113 id++;
115 psp[id].dwSize = sizeof (PROPSHEETPAGEW);
116 psp[id].hInstance = hcpl;
117 psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_SECURITY);
118 psp[id].pfnDlgProc = security_dlgproc;
119 id++;
121 psp[id].dwSize = sizeof (PROPSHEETPAGEW);
122 psp[id].hInstance = hcpl;
123 psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_CONTENT);
124 psp[id].pfnDlgProc = content_dlgproc;
125 id++;
127 psp[id].dwSize = sizeof (PROPSHEETPAGEW);
128 psp[id].hInstance = hcpl;
129 psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_CONNECTIONS);
130 psp[id].pfnDlgProc = connections_dlgproc;
131 id++;
133 /* Fill out the PROPSHEETHEADER */
134 psh.dwSize = sizeof (PROPSHEETHEADERW);
135 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
136 psh.hwndParent = parent;
137 psh.hInstance = hcpl;
138 psh.u.pszIcon = MAKEINTRESOURCEW(ICO_MAIN);
139 psh.pszCaption = MAKEINTRESOURCEW(IDS_CPL_NAME);
140 psh.nPages = id;
141 psh.u3.ppsp = psp;
142 psh.pfnCallback = propsheet_callback;
144 /* display the dialog */
145 PropertySheetW(&psh);
147 OleUninitialize();
150 /*********************************************************************
151 * CPlApplet (inetcpl.@)
153 * Control Panel entry point
155 * PARAMS
156 * hWnd [I] Handle for the Control Panel Window
157 * command [I] CPL_* Command
158 * lParam1 [I] first extra Parameter
159 * lParam2 [I] second extra Parameter
161 * RETURNS
162 * Depends on the command
165 LONG CALLBACK CPlApplet(HWND hWnd, UINT command, LPARAM lParam1, LPARAM lParam2)
167 TRACE("(%p, %u, 0x%Ix, 0x%Ix)\n", hWnd, command, lParam1, lParam2);
169 switch (command)
171 case CPL_INIT:
172 return TRUE;
174 case CPL_GETCOUNT:
175 return 1;
177 case CPL_INQUIRE:
179 CPLINFO *appletInfo = (CPLINFO *) lParam2;
181 appletInfo->idIcon = ICO_MAIN;
182 appletInfo->idName = IDS_CPL_NAME;
183 appletInfo->idInfo = IDS_CPL_INFO;
184 appletInfo->lData = 0;
185 return TRUE;
188 case CPL_DBLCLK:
189 display_cpl_sheets(hWnd);
190 break;
193 return FALSE;
196 /*********************************************************************
197 * LaunchInternetControlPanel (inetcpl.@)
199 * Launch the Internet Control Panel dialog
201 * PARAMS
202 * parent [I] Handle for the parent window
204 * RETURNS
205 * Success: TRUE
207 * NOTES
208 * rundll32 callable function: rundll32 inetcpl.cpl,LaunchInternetControlPanel
211 BOOL WINAPI LaunchInternetControlPanel(HWND parent)
213 display_cpl_sheets(parent);
214 return TRUE;
217 /*********************************************************************
218 * LaunchConnectionDialog (inetcpl.@)
221 BOOL WINAPI LaunchConnectionDialog(HWND hParent)
223 FIXME("(%p): stub\n", hParent);
224 return FALSE;
227 /*********************************************************************
228 * LaunchInternetControlPanel (inetcpl.@)
231 BOOL WINAPI LaunchPrivacyDialog(HWND hParent)
233 FIXME("(%p): stub\n", hParent);
234 return FALSE;