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

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

Add: ShellExecuteW, RealShellExecuteA, RealShellExecuteW, RealShellExecuteExA, RealShellExecuteExW

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