riched20: Use cell ptrs in the rtf parsing code.
[wine/zf.git] / dlls / inetcpl.cpl / inetcpl.c
blobe2178e1fac6ac42a1d0f00d0466a7a9f59db9265
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, %d, %p)\n", hdll, reason, reserved);
51 switch (reason)
53 case DLL_WINE_PREATTACH:
54 return FALSE; /* prefer native version */
56 case DLL_PROCESS_ATTACH:
57 DisableThreadLibraryCalls(hdll);
58 hcpl = hdll;
60 return TRUE;
63 /***********************************************************************
64 * DllInstall (inetcpl.@)
66 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
68 FIXME("(%s, %s): stub\n", bInstall ? "TRUE" : "FALSE", debugstr_w(cmdline));
69 return S_OK;
72 /******************************************************************************
73 * propsheet_callback [internal]
76 static int CALLBACK propsheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
79 TRACE("(%p, 0x%08x/%d, 0x%lx)\n", hwnd, msg, msg, lparam);
80 switch (msg)
82 case PSCB_INITIALIZED:
83 SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIconW(hcpl, MAKEINTRESOURCEW(ICO_MAIN)));
84 break;
86 return 0;
89 /******************************************************************************
90 * display_cpl_sheets [internal]
92 * Build and display the dialog with all control panel propertysheets
95 static void display_cpl_sheets(HWND parent)
97 INITCOMMONCONTROLSEX icex;
98 PROPSHEETPAGEW psp[NUM_PROPERTY_PAGES];
99 PROPSHEETHEADERW psh;
100 DWORD id = 0;
102 OleInitialize(NULL);
103 /* Initialize common controls */
104 icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
105 icex.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES;
106 InitCommonControlsEx(&icex);
108 ZeroMemory(&psh, sizeof(psh));
109 ZeroMemory(psp, sizeof(psp));
111 /* Fill out all PROPSHEETPAGE */
112 psp[id].dwSize = sizeof (PROPSHEETPAGEW);
113 psp[id].hInstance = hcpl;
114 psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_GENERAL);
115 psp[id].pfnDlgProc = general_dlgproc;
116 id++;
118 psp[id].dwSize = sizeof (PROPSHEETPAGEW);
119 psp[id].hInstance = hcpl;
120 psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_SECURITY);
121 psp[id].pfnDlgProc = security_dlgproc;
122 id++;
124 psp[id].dwSize = sizeof (PROPSHEETPAGEW);
125 psp[id].hInstance = hcpl;
126 psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_CONTENT);
127 psp[id].pfnDlgProc = content_dlgproc;
128 id++;
130 psp[id].dwSize = sizeof (PROPSHEETPAGEW);
131 psp[id].hInstance = hcpl;
132 psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_CONNECTIONS);
133 psp[id].pfnDlgProc = connections_dlgproc;
134 id++;
136 /* Fill out the PROPSHEETHEADER */
137 psh.dwSize = sizeof (PROPSHEETHEADERW);
138 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
139 psh.hwndParent = parent;
140 psh.hInstance = hcpl;
141 psh.u.pszIcon = MAKEINTRESOURCEW(ICO_MAIN);
142 psh.pszCaption = MAKEINTRESOURCEW(IDS_CPL_NAME);
143 psh.nPages = id;
144 psh.u3.ppsp = psp;
145 psh.pfnCallback = propsheet_callback;
147 /* display the dialog */
148 PropertySheetW(&psh);
150 OleUninitialize();
153 /*********************************************************************
154 * CPlApplet (inetcpl.@)
156 * Control Panel entry point
158 * PARAMS
159 * hWnd [I] Handle for the Control Panel Window
160 * command [I] CPL_* Command
161 * lParam1 [I] first extra Parameter
162 * lParam2 [I] second extra Parameter
164 * RETURNS
165 * Depends on the command
168 LONG CALLBACK CPlApplet(HWND hWnd, UINT command, LPARAM lParam1, LPARAM lParam2)
170 TRACE("(%p, %u, 0x%lx, 0x%lx)\n", hWnd, command, lParam1, lParam2);
172 switch (command)
174 case CPL_INIT:
175 return TRUE;
177 case CPL_GETCOUNT:
178 return 1;
180 case CPL_INQUIRE:
182 CPLINFO *appletInfo = (CPLINFO *) lParam2;
184 appletInfo->idIcon = ICO_MAIN;
185 appletInfo->idName = IDS_CPL_NAME;
186 appletInfo->idInfo = IDS_CPL_INFO;
187 appletInfo->lData = 0;
188 return TRUE;
191 case CPL_DBLCLK:
192 display_cpl_sheets(hWnd);
193 break;
196 return FALSE;
199 /*********************************************************************
200 * LaunchInternetControlPanel (inetcpl.@)
202 * Launch the Internet Control Panel dialog
204 * PARAMS
205 * parent [I] Handle for the parent window
207 * RETURNS
208 * Success: TRUE
210 * NOTES
211 * rundll32 callable function: rundll32 inetcpl.cpl,LaunchInternetControlPanel
214 BOOL WINAPI LaunchInternetControlPanel(HWND parent)
216 display_cpl_sheets(parent);
217 return TRUE;
220 /*********************************************************************
221 * LaunchConnectionDialog (inetcpl.@)
224 BOOL WINAPI LaunchConnectionDialog(HWND hParent)
226 FIXME("(%p): stub\n", hParent);
227 return FALSE;
230 /*********************************************************************
231 * LaunchInternetControlPanel (inetcpl.@)
234 BOOL WINAPI LaunchPrivacyDialog(HWND hParent)
236 FIXME("(%p): stub\n", hParent);
237 return FALSE;