source: trunk/src/shell32/shell32.cpp@ 168

Last change on this file since 168 was 168, checked in by phaller, 26 years ago

Add: ExtractAssociatedIconA/W added, source files split

File size: 10.6 KB
Line 
1/* $Id: shell32.cpp,v 1.6 1999-06-23 22:17:52 phaller Exp $ */
2
3/*
4 * Win32 SHELL32 for OS/2
5 *
6 * 1998/06/15 Patrick Haller (haller@zebra.fh-weingarten.de)
7 *
8 * @(#) shell32.c 1.0.0 1998/06/15 PH Merge WINE/SHELLORD.C
9 *
10 *
11 * Copyright 1997 Marcus Meissner
12 * Copyright 1988 Patrick Haller (adapted for win32os2)
13 *
14 * Project Odin Software License can be found in LICENSE.TXT
15 *
16 */
17
18
19/*****************************************************************************
20 * Includes *
21 *****************************************************************************/
22
23#include <os2win.h>
24#include <shellapi.h>
25#include <winreg.h>
26#include "shell32.h"
27
28#include <stdarg.h>
29//#include <builtin.h>
30#include <stdio.h>
31#include <stdlib.h>
32#include <string.h>
33
34#include <misc.h>
35#include <nameid.h>
36#include <unicode.h>
37
38
39//static const char* lpstrMsgWndCreated = "OTHERWINDOWCREATED";
40//static const char* lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED";
41//static const char* lpstrMsgShellActivate = "ACTIVATESHELLWINDOW";
42
43//static HWND SHELL_hWnd = 0;
44//static HHOOK SHELL_hHook = 0;
45//static USHORT uMsgWndCreated = 0;
46//static USHORT uMsgWndDestroyed = 0;
47//static USHORT uMsgShellActivate = 0;
48
49
50
51/*****************************************************************************
52 * Types & Defines *
53 *****************************************************************************/
54
55
56//******************************************************************************
57//******************************************************************************
58HINSTANCE WIN32API ShellExecuteA(HWND hwnd,
59 LPCTSTR lpOperation,
60 LPCTSTR lpFile,
61 LPCTSTR lpParameters,
62 LPCTSTR lpDirectory,
63 INT nShowCmd)
64{
65 dprintf (("SHELL32: ShellExecuteA(%08xh,%s,%s,%s,%s,%08xh) not implemented.\n",
66 hwnd,
67 lpOperation,
68 lpFile,
69 lpParameters,
70 lpDirectory,
71 nShowCmd));
72
73 return(0); //out of memory
74}
75//******************************************************************************
76//TODO: Make nice dialog window
77//******************************************************************************
78int WIN32API ShellAboutA(HWND hwnd,
79 LPCTSTR szApp,
80 LPCTSTR szOtherStuff,
81 HICON hIcon)
82{
83 dprintf(("SHELL32: ShellAboutA(%08xh,%08xh,%08xh,%08xh) not implemented properly.\n",
84 hwnd,
85 szApp,
86 szOtherStuff,
87 hIcon));
88
89 /* @@@PH 98/06/07 */
90 if (szOtherStuff == NULL) szOtherStuff = "";
91 if (szApp == NULL) szApp = "";
92
93 MessageBoxA(NULL,
94 szOtherStuff,
95 szApp,
96 MB_OK); /*PLF Sun 97-11-23 22:58:49*/
97
98 return(TRUE);
99}
100
101
102/*****************************************************************************
103 * Name : DWORD ShellAboutW
104 * Purpose : display a simple about box
105 * Parameters: HWND hwnd
106 * LPWSTR szApplication
107 * LPWSTR szMoreInformation
108 * HICON hIcon
109 * Variables :
110 * Result :
111 * Remark :
112 * Status : UNTESTED
113 *
114 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
115 *****************************************************************************/
116
117int WIN32API ShellAboutW(HWND hwnd,
118 LPCWSTR szApp,
119 LPCWSTR szOtherStuff,
120 HICON hIcon)
121{
122 LPSTR lpszApp; /* temporary buffers for A-W conversion */
123 LPSTR lpszOtherStuff;
124 int iResult;
125
126 dprintf(("SHELL32: ShellAboutW(%08xh,%08xh,%08xh,%08xh).\n",
127 hwnd,
128 szApp,
129 szOtherStuff,
130 hIcon));
131
132 if (szApp != NULL) /* convert string on demand */
133 lpszApp = UnicodeToAsciiString((LPWSTR)szApp);
134 else
135 lpszApp = NULL;
136
137 if (szOtherStuff != NULL)
138 lpszOtherStuff = UnicodeToAsciiString((LPWSTR)szOtherStuff);
139 else
140 lpszOtherStuff = NULL;
141
142 iResult = ShellAboutA(hwnd, /* call ascii variant */
143 lpszApp,
144 lpszOtherStuff,
145 hIcon);
146
147 if (lpszApp != NULL) /* free strings as created */
148 FreeAsciiString(lpszApp);
149
150 if (lpszOtherStuff != NULL)
151 FreeAsciiString(lpszOtherStuff);
152
153 return(iResult);
154}
155
156
157/*************************************************************************
158 * Shell_NotifyIcon [SHELL32.240]
159 * FIXME
160 * This function is supposed to deal with the systray.
161 * Any ideas on how this is to be implimented?
162 */
163BOOL WIN32API Shell_NotifyIconA(DWORD dwMessage,
164 PNOTIFYICONDATAA pnid )
165{
166 dprintf(("SHELL32: Shell_NotifyIconA(%08xh,%08xh) not implemented.\n",
167 dwMessage,
168 pnid));
169
170 return FALSE;
171}
172
173
174/*************************************************************************
175 * Shell_NotifyIcon [SHELL32.240]
176 * FIXME
177 * This function is supposed to deal with the systray.
178 * Any ideas on how this is to be implimented?
179 */
180BOOL WIN32API Shell_NotifyIconW(DWORD dwMessage,
181 PNOTIFYICONDATAW pnid )
182{
183 dprintf(("SHELL32: Shell_NotifyIconW(%08xh,%08xh) not implemented.\n",
184 dwMessage,
185 pnid));
186
187 return FALSE;
188}
189
190
191/*****************************************************************************
192 * Name : BOOL ShellExecuteEx
193 * Purpose :
194 * Parameters:
195 * Variables :
196 * Result :
197 * Remark :
198 * Status : UNTESTED STUB
199 *
200 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
201 *****************************************************************************/
202
203BOOL WIN32API ShellExecuteEx(LPSHELLEXECUTEINFOA lpExecInfo)
204{
205 dprintf(("SHELL32: ShellExecuteEx (%08xh) not implemented.\n",
206 lpExecInfo));
207
208 return (0);
209}
210
211
212
213/*****************************************************************************
214 * Name : BOOL ShellExecuteExA
215 * Purpose :
216 * Parameters:
217 * Variables :
218 * Result :
219 * Remark :
220 * Status : UNTESTED STUB
221 *
222 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
223 *****************************************************************************/
224
225BOOL WIN32API ShellExecuteExA(LPSHELLEXECUTEINFOA lpExecInfo)
226{
227 dprintf(("SHELL32: ShellExecuteExA (%08xh) not implemented.\n",
228 lpExecInfo));
229
230 return (0);
231}
232
233
234/*****************************************************************************
235 * Name : BOOL ShellExecuteExW
236 * Purpose :
237 * Parameters:
238 * Variables :
239 * Result :
240 * Remark :
241 * Status : UNTESTED STUB
242 *
243 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
244 *****************************************************************************/
245
246BOOL WIN32API ShellExecuteExW(LPSHELLEXECUTEINFOW lpExecInfo)
247{
248 dprintf(("SHELL32: ShellExecuteExW (%08xh) not implemented.\n",
249 lpExecInfo));
250
251 return (0);
252}
253
254
255/*****************************************************************************
256 * Name : DWORD ShellMessageBoxW
257 * Purpose : display a messagebox, retrieve message text from resources
258 * Parameters: HMODULE hmod
259 * HWND hwnd
260 * DWORD idText
261 * DWORD idTitle
262 * DWORD uType
263 * LPCVOID arglist
264 * Variables :
265 * Result :
266 * Remark : SHELL32.182
267 * Status : UNTESTED STUB
268 *
269 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
270 *****************************************************************************/
271
272DWORD WIN32API ShellMessageBoxW(HMODULE hmod,
273 HWND hwnd,
274 DWORD idText,
275 DWORD idTitle,
276 DWORD uType,
277 LPCVOID arglist)
278{
279 WCHAR szText[100],
280 szTitle[100],
281 szTemp[256];
282 LPWSTR pszText = &szText[0],
283 pszTitle = &szTitle[0];
284 LPVOID args = &arglist;
285
286 dprintf(("SHELL32: ShellMessageBoxW(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",
287 hmod,
288 hwnd,
289 idText,
290 idTitle,
291 uType,
292 arglist));
293
294 if (!HIWORD (idTitle))
295 LoadStringW(hmod,
296 idTitle,
297 pszTitle,
298 100);
299 else
300 pszTitle = (LPWSTR)idTitle;
301
302 if (! HIWORD (idText))
303 LoadStringW(hmod,idText,pszText,100);
304 else
305 pszText = (LPWSTR)idText;
306
307 FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
308 szText,
309 0,
310 0,
311 szTemp,
312 256,
313 (LPDWORD)args);
314
315 return MessageBoxW(hwnd,
316 szTemp,
317 szTitle,
318 uType);
319}
320
321
322/*****************************************************************************
323 * Name : DWORD ShellMessageBoxA
324 * Purpose : display a messagebox, retrieve message text from resources
325 * Parameters: HMODULE hmod
326 * HWND hwnd
327 * DWORD idText
328 * DWORD idTitle
329 * DWORD uType
330 * LPCVOID arglist
331 * Variables :
332 * Result :
333 * Remark : SHELL32.183
334 * Status : UNTESTED STUB
335 *
336 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
337 *****************************************************************************/
338
339DWORD WIN32API ShellMessageBoxA(HMODULE hmod,
340 HWND hwnd,
341 DWORD idText,
342 DWORD idTitle,
343 DWORD uType,
344 LPCVOID arglist)
345{
346 char szText[100],
347 szTitle[100],
348 szTemp[256];
349 LPSTR pszText = &szText[0],
350 pszTitle = &szTitle[0];
351 LPVOID args = &arglist;
352
353 dprintf(("SHELL32: ShellMessageBoxA (%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",
354 hmod,
355 hwnd,
356 idText,
357 idTitle,
358 uType,
359 arglist));
360
361 if (!HIWORD (idTitle))
362 LoadStringA(hmod,idTitle,pszTitle,100);
363 else
364 pszTitle = (LPSTR)idTitle;
365
366 if (! HIWORD (idText))
367 LoadStringA(hmod,idText,pszText,100);
368 else
369 pszText = (LPSTR)idText;
370
371 FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
372 pszText,
373 0,
374 0,
375 szTemp,
376 256,
377 (LPDWORD)args);
378
379 return MessageBoxA(hwnd,
380 szTemp,
381 pszTitle,
382 uType);
383}
384
385
Note: See TracBrowser for help on using the repository browser.