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

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

Add: even more SHELL32 APIs ... and some corrections

File size: 13.6 KB
Line 
1/* $Id: shell32.cpp,v 1.8 1999-06-24 19:27:49 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 <odin.h>
24#include <os2win.h>
25#include <shellapi.h>
26#include <winreg.h>
27#include "shell32.h"
28
29#include <stdarg.h>
30//#include <builtin.h>
31#include <stdio.h>
32#include <stdlib.h>
33#include <string.h>
34
35#include <misc.h>
36#include <nameid.h>
37#include <unicode.h>
38
39
40//static const char* lpstrMsgWndCreated = "OTHERWINDOWCREATED";
41//static const char* lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED";
42//static const char* lpstrMsgShellActivate = "ACTIVATESHELLWINDOW";
43
44//static HWND SHELL_hWnd = 0;
45//static HHOOK SHELL_hHook = 0;
46//static USHORT uMsgWndCreated = 0;
47//static USHORT uMsgWndDestroyed = 0;
48//static USHORT uMsgShellActivate = 0;
49
50
51
52/*****************************************************************************
53 * Types & Defines *
54 *****************************************************************************/
55
56
57/*****************************************************************************
58 * Name : HINSTANCE ShellExecuteA
59 * Purpose : Start a program
60 * Parameters: HWND hwnd
61 * LPCTSTR lpOperation
62 * LPCTSTR lpFile
63 * LPCTSTR lpParameters
64 * LPCTSTR lpDirectory
65 * INT nShowCmd
66 * Variables :
67 * Result :
68 * Remark : SHELL32.289
69 * Status : UNTESTED
70 *
71 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
72 *****************************************************************************/
73
74HINSTANCE WIN32API ShellExecuteA(HWND hwnd,
75 LPCTSTR lpOperation,
76 LPCTSTR lpFile,
77 LPCTSTR lpParameters,
78 LPCTSTR lpDirectory,
79 INT nShowCmd)
80{
81 dprintf (("SHELL32: ShellExecuteA(%08xh,%s,%s,%s,%s,%08xh) not implemented.\n",
82 hwnd,
83 lpOperation,
84 lpFile,
85 lpParameters,
86 lpDirectory,
87 nShowCmd));
88
89 return(0); //out of memory
90}
91
92
93/*****************************************************************************
94 * Name : HINSTANCE ShellExecuteW
95 * Purpose : Start a program
96 * Parameters: HWND hwnd
97 * LPCWSTR lpOperation
98 * LPCWSTR lpFile
99 * LPCWSTR lpParameters
100 * LPCWSTR lpDirectory
101 * INT nShowCmd
102 * Variables :
103 * Result :
104 * Remark : SHELL32.293
105 * Status : UNTESTED
106 *
107 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
108 *****************************************************************************/
109
110HINSTANCE WIN32API ShellExecuteW(HWND hwnd,
111 LPCWSTR lpOperation,
112 LPCWSTR lpFile,
113 LPCWSTR lpParameters,
114 LPCWSTR lpDirectory,
115 INT nShowCmd)
116{
117 HINSTANCE hInstance;
118 LPSTR lpOperationA = UnicodeToAsciiString((LPWSTR)lpOperation);
119 LPSTR lpFileA = UnicodeToAsciiString((LPWSTR)lpFile);
120 LPSTR lpParametersA = UnicodeToAsciiString((LPWSTR)lpParameters);
121 LPSTR lpDirectoryA = UnicodeToAsciiString((LPWSTR)lpDirectory);
122
123 dprintf (("SHELL32: ShellExecuteW(%08xh,%s,%s,%s,%s,%08xh).\n",
124 hwnd,
125 lpOperationA,
126 lpFileA,
127 lpParametersA,
128 lpDirectoryA,
129 nShowCmd));
130
131 hInstance = ShellExecuteA(hwnd,
132 lpOperationA,
133 lpFileA,
134 lpParametersA,
135 lpDirectoryA,
136 nShowCmd);
137
138 FreeAsciiString(lpOperationA);
139 FreeAsciiString(lpFileA);
140 FreeAsciiString(lpParametersA);
141 FreeAsciiString(lpDirectoryA);
142
143 return hInstance;
144}
145
146
147
148/*****************************************************************************
149 * Name : DWORD ShellAboutA
150 * Purpose : display a simple about box
151 * Parameters: HWND hwnd
152 * LPSTR szApplication
153 * LPSTR szMoreInformation
154 * HICON hIcon
155 * Variables :
156 * Result :
157 * Remark : SHELL32.287
158 * Status : UNTESTED
159 *
160 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
161 *****************************************************************************/
162
163int WIN32API ShellAboutA(HWND hwnd,
164 LPCTSTR szApp,
165 LPCTSTR szOtherStuff,
166 HICON hIcon)
167{
168 dprintf(("SHELL32: ShellAboutA(%08xh,%08xh,%08xh,%08xh) not implemented properly.\n",
169 hwnd,
170 szApp,
171 szOtherStuff,
172 hIcon));
173
174 /* @@@PH 98/06/07 */
175 if (szOtherStuff == NULL) szOtherStuff = "";
176 if (szApp == NULL) szApp = "";
177
178 MessageBoxA(NULL,
179 szOtherStuff,
180 szApp,
181 MB_OK); /*PLF Sun 97-11-23 22:58:49*/
182
183 return(TRUE);
184}
185
186
187/*****************************************************************************
188 * Name : DWORD ShellAboutW
189 * Purpose : display a simple about box
190 * Parameters: HWND hwnd
191 * LPWSTR szApplication
192 * LPWSTR szMoreInformation
193 * HICON hIcon
194 * Variables :
195 * Result :
196 * Remark : SHELL32.288
197 * Status : UNTESTED
198 *
199 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
200 *****************************************************************************/
201
202int WIN32API ShellAboutW(HWND hwnd,
203 LPCWSTR szApp,
204 LPCWSTR szOtherStuff,
205 HICON hIcon)
206{
207 LPSTR lpszApp; /* temporary buffers for A-W conversion */
208 LPSTR lpszOtherStuff;
209 int iResult;
210
211 dprintf(("SHELL32: ShellAboutW(%08xh,%08xh,%08xh,%08xh).\n",
212 hwnd,
213 szApp,
214 szOtherStuff,
215 hIcon));
216
217 if (szApp != NULL) /* convert string on demand */
218 lpszApp = UnicodeToAsciiString((LPWSTR)szApp);
219 else
220 lpszApp = NULL;
221
222 if (szOtherStuff != NULL)
223 lpszOtherStuff = UnicodeToAsciiString((LPWSTR)szOtherStuff);
224 else
225 lpszOtherStuff = NULL;
226
227 iResult = ShellAboutA(hwnd, /* call ascii variant */
228 lpszApp,
229 lpszOtherStuff,
230 hIcon);
231
232 if (lpszApp != NULL) /* free strings as created */
233 FreeAsciiString(lpszApp);
234
235 if (lpszOtherStuff != NULL)
236 FreeAsciiString(lpszOtherStuff);
237
238 return(iResult);
239}
240
241
242/*****************************************************************************
243 * Name : BOOL Shell_NotifyIconA
244 * Purpose :
245 * Parameters:
246 * Variables :
247 * Result :
248 * Remark : SHELL32.296 .297
249 * Status : UNTESTED STUB
250 *
251 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
252 *****************************************************************************/
253
254BOOL WIN32API Shell_NotifyIconA(DWORD dwMessage,
255 PNOTIFYICONDATAA pnid)
256{
257 dprintf(("SHELL32: Shell_NotifyIconA(%08xh,%08xh) not implemented.\n",
258 dwMessage,
259 pnid));
260
261 return FALSE;
262}
263
264
265/*****************************************************************************
266 * Name : BOOL Shell_NotifyIconW
267 * Purpose :
268 * Parameters:
269 * Variables :
270 * Result :
271 * Remark : SHELL32.298
272 * Status : UNTESTED STUB
273 *
274 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
275 *****************************************************************************/
276
277BOOL WIN32API Shell_NotifyIconW(DWORD dwMessage,
278 PNOTIFYICONDATAW pnid )
279{
280 dprintf(("SHELL32: Shell_NotifyIconW(%08xh,%08xh) not implemented.\n",
281 dwMessage,
282 pnid));
283
284 return FALSE;
285}
286
287
288/*****************************************************************************
289 * Name : BOOL ShellExecuteEx
290 * Purpose :
291 * Parameters:
292 * Variables :
293 * Result :
294 * Remark :
295 * Status : UNTESTED STUB
296 *
297 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
298 *****************************************************************************/
299
300BOOL WIN32API ShellExecuteEx(LPSHELLEXECUTEINFOA lpExecInfo)
301{
302 dprintf(("SHELL32: ShellExecuteEx (%08xh) not implemented.\n",
303 lpExecInfo));
304
305 return (0);
306}
307
308
309
310/*****************************************************************************
311 * Name : BOOL ShellExecuteExA
312 * Purpose :
313 * Parameters:
314 * Variables :
315 * Result :
316 * Remark : SHELL32.290 .291
317 * Status : UNTESTED STUB
318 *
319 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
320 *****************************************************************************/
321
322BOOL WIN32API ShellExecuteExA(LPSHELLEXECUTEINFOA lpExecInfo)
323{
324 dprintf(("SHELL32: ShellExecuteExA (%08xh) not implemented.\n",
325 lpExecInfo));
326
327 return (0);
328}
329
330
331/*****************************************************************************
332 * Name : BOOL ShellExecuteExW
333 * Purpose :
334 * Parameters:
335 * Variables :
336 * Result :
337 * Remark : SHELL32.292
338 * Status : UNTESTED STUB
339 *
340 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
341 *****************************************************************************/
342
343BOOL WIN32API ShellExecuteExW(LPSHELLEXECUTEINFOW lpExecInfo)
344{
345 dprintf(("SHELL32: ShellExecuteExW (%08xh) not implemented.\n",
346 lpExecInfo));
347
348 return (0);
349}
350
351
352/*****************************************************************************
353 * Name : DWORD ShellMessageBoxW
354 * Purpose : display a messagebox, retrieve message text from resources
355 * Parameters: HMODULE hmod
356 * HWND hwnd
357 * DWORD idText
358 * DWORD idTitle
359 * DWORD uType
360 * LPCVOID arglist
361 * Variables :
362 * Result :
363 * Remark : SHELL32.182
364 * Status : UNTESTED STUB
365 *
366 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
367 *****************************************************************************/
368
369DWORD CDECL ShellMessageBoxW(HMODULE hmod,
370 HWND hwnd,
371 DWORD idText,
372 DWORD idTitle,
373 DWORD uType,
374 LPCVOID arglist)
375{
376 WCHAR szText[100],
377 szTitle[100],
378 szTemp[256];
379 LPWSTR pszText = &szText[0],
380 pszTitle = &szTitle[0];
381 LPVOID args = &arglist;
382
383 dprintf(("SHELL32: ShellMessageBoxW(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",
384 hmod,
385 hwnd,
386 idText,
387 idTitle,
388 uType,
389 arglist));
390
391 if (!HIWORD (idTitle))
392 LoadStringW(hmod,
393 idTitle,
394 pszTitle,
395 100);
396 else
397 pszTitle = (LPWSTR)idTitle;
398
399 if (! HIWORD (idText))
400 LoadStringW(hmod,
401 idText,
402 pszText,
403 100);
404 else
405 pszText = (LPWSTR)idText;
406
407 FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
408 szText,
409 0,
410 0,
411 szTemp,
412 256,
413 (LPDWORD)args);
414
415 return MessageBoxW(hwnd,
416 szTemp,
417 szTitle,
418 uType);
419}
420
421
422/*****************************************************************************
423 * Name : DWORD ShellMessageBoxA
424 * Purpose : display a messagebox, retrieve message text from resources
425 * Parameters: HMODULE hmod
426 * HWND hwnd
427 * DWORD idText
428 * DWORD idTitle
429 * DWORD uType
430 * LPCVOID arglist
431 * Variables :
432 * Result :
433 * Remark : SHELL32.183
434 * Status : UNTESTED STUB
435 *
436 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
437 *****************************************************************************/
438
439DWORD CDECL ShellMessageBoxA(HMODULE hmod,
440 HWND hwnd,
441 DWORD idText,
442 DWORD idTitle,
443 DWORD uType,
444 LPCVOID arglist)
445{
446 char szText[100],
447 szTitle[100],
448 szTemp[256];
449 LPSTR pszText = &szText[0],
450 pszTitle = &szTitle[0];
451 LPVOID args = &arglist;
452
453 dprintf(("SHELL32: ShellMessageBoxA (%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",
454 hmod,
455 hwnd,
456 idText,
457 idTitle,
458 uType,
459 arglist));
460
461 if (!HIWORD (idTitle))
462 LoadStringA(hmod,
463 idTitle,
464 pszTitle,
465 100);
466 else
467 pszTitle = (LPSTR)idTitle;
468
469 if (! HIWORD (idText))
470 LoadStringA(hmod,
471 idText,
472 pszText,
473 100);
474 else
475 pszText = (LPSTR)idText;
476
477 FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
478 pszText,
479 0,
480 0,
481 szTemp,
482 256,
483 (LPDWORD)args);
484
485 return MessageBoxA(hwnd,
486 szTemp,
487 pszTitle,
488 uType);
489}
Note: See TracBrowser for help on using the repository browser.