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

Last change on this file since 1036 was 972, checked in by sandervl, 26 years ago

Import lstrncmpiA from kernel32

File size: 13.5 KB
Line 
1/* $Id: shell32.cpp,v 1.9 1999-09-18 15:57:52 sandervl 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 <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 : SHELL32.289
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 : SHELL32.293
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 : SHELL32.287
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 : SHELL32.288
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 * Name : BOOL Shell_NotifyIconA
243 * Purpose :
244 * Parameters:
245 * Variables :
246 * Result :
247 * Remark : SHELL32.296 .297
248 * Status : UNTESTED STUB
249 *
250 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
251 *****************************************************************************/
252
253BOOL WIN32API Shell_NotifyIconA(DWORD dwMessage,
254 PNOTIFYICONDATAA pnid)
255{
256 dprintf(("SHELL32: Shell_NotifyIconA(%08xh,%08xh) not implemented.\n",
257 dwMessage,
258 pnid));
259
260 return FALSE;
261}
262
263
264/*****************************************************************************
265 * Name : BOOL Shell_NotifyIconW
266 * Purpose :
267 * Parameters:
268 * Variables :
269 * Result :
270 * Remark : SHELL32.298
271 * Status : UNTESTED STUB
272 *
273 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
274 *****************************************************************************/
275
276BOOL WIN32API Shell_NotifyIconW(DWORD dwMessage,
277 PNOTIFYICONDATAW pnid )
278{
279 dprintf(("SHELL32: Shell_NotifyIconW(%08xh,%08xh) not implemented.\n",
280 dwMessage,
281 pnid));
282
283 return FALSE;
284}
285
286
287/*****************************************************************************
288 * Name : BOOL ShellExecuteEx
289 * Purpose :
290 * Parameters:
291 * Variables :
292 * Result :
293 * Remark :
294 * Status : UNTESTED STUB
295 *
296 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
297 *****************************************************************************/
298
299BOOL WIN32API ShellExecuteEx(LPSHELLEXECUTEINFOA lpExecInfo)
300{
301 dprintf(("SHELL32: ShellExecuteEx (%08xh) not implemented.\n",
302 lpExecInfo));
303
304 return (0);
305}
306
307
308
309/*****************************************************************************
310 * Name : BOOL ShellExecuteExA
311 * Purpose :
312 * Parameters:
313 * Variables :
314 * Result :
315 * Remark : SHELL32.290 .291
316 * Status : UNTESTED STUB
317 *
318 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
319 *****************************************************************************/
320
321BOOL WIN32API ShellExecuteExA(LPSHELLEXECUTEINFOA lpExecInfo)
322{
323 dprintf(("SHELL32: ShellExecuteExA (%08xh) not implemented.\n",
324 lpExecInfo));
325
326 return (0);
327}
328
329
330/*****************************************************************************
331 * Name : BOOL ShellExecuteExW
332 * Purpose :
333 * Parameters:
334 * Variables :
335 * Result :
336 * Remark : SHELL32.292
337 * Status : UNTESTED STUB
338 *
339 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
340 *****************************************************************************/
341
342BOOL WIN32API ShellExecuteExW(LPSHELLEXECUTEINFOW lpExecInfo)
343{
344 dprintf(("SHELL32: ShellExecuteExW (%08xh) not implemented.\n",
345 lpExecInfo));
346
347 return (0);
348}
349
350
351/*****************************************************************************
352 * Name : DWORD ShellMessageBoxW
353 * Purpose : display a messagebox, retrieve message text from resources
354 * Parameters: HMODULE hmod
355 * HWND hwnd
356 * DWORD idText
357 * DWORD idTitle
358 * DWORD uType
359 * LPCVOID arglist
360 * Variables :
361 * Result :
362 * Remark : SHELL32.182
363 * Status : UNTESTED STUB
364 *
365 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
366 *****************************************************************************/
367
368DWORD CDECL ShellMessageBoxW(HMODULE hmod,
369 HWND hwnd,
370 DWORD idText,
371 DWORD idTitle,
372 DWORD uType,
373 LPCVOID arglist)
374{
375 WCHAR szText[100],
376 szTitle[100],
377 szTemp[256];
378 LPWSTR pszText = &szText[0],
379 pszTitle = &szTitle[0];
380 LPVOID args = &arglist;
381
382 dprintf(("SHELL32: ShellMessageBoxW(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",
383 hmod,
384 hwnd,
385 idText,
386 idTitle,
387 uType,
388 arglist));
389
390 if (!HIWORD (idTitle))
391 LoadStringW(hmod,
392 idTitle,
393 pszTitle,
394 100);
395 else
396 pszTitle = (LPWSTR)idTitle;
397
398 if (! HIWORD (idText))
399 LoadStringW(hmod,
400 idText,
401 pszText,
402 100);
403 else
404 pszText = (LPWSTR)idText;
405
406 FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
407 szText,
408 0,
409 0,
410 szTemp,
411 256,
412 (LPDWORD)args);
413
414 return MessageBoxW(hwnd,
415 szTemp,
416 szTitle,
417 uType);
418}
419
420
421/*****************************************************************************
422 * Name : DWORD ShellMessageBoxA
423 * Purpose : display a messagebox, retrieve message text from resources
424 * Parameters: HMODULE hmod
425 * HWND hwnd
426 * DWORD idText
427 * DWORD idTitle
428 * DWORD uType
429 * LPCVOID arglist
430 * Variables :
431 * Result :
432 * Remark : SHELL32.183
433 * Status : UNTESTED STUB
434 *
435 * Author : Patrick Haller [Tue, 1999/06/01 09:00]
436 *****************************************************************************/
437
438DWORD CDECL ShellMessageBoxA(HMODULE hmod,
439 HWND hwnd,
440 DWORD idText,
441 DWORD idTitle,
442 DWORD uType,
443 LPCVOID arglist)
444{
445 char szText[100],
446 szTitle[100],
447 szTemp[256];
448 LPSTR pszText = &szText[0],
449 pszTitle = &szTitle[0];
450 LPVOID args = &arglist;
451
452 dprintf(("SHELL32: ShellMessageBoxA (%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",
453 hmod,
454 hwnd,
455 idText,
456 idTitle,
457 uType,
458 arglist));
459
460 if (!HIWORD (idTitle))
461 LoadStringA(hmod,
462 idTitle,
463 pszTitle,
464 100);
465 else
466 pszTitle = (LPSTR)idTitle;
467
468 if (! HIWORD (idText))
469 LoadStringA(hmod,
470 idText,
471 pszText,
472 100);
473 else
474 pszText = (LPSTR)idText;
475
476 FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
477 pszText,
478 0,
479 0,
480 szTemp,
481 256,
482 (LPDWORD)args);
483
484 return MessageBoxA(hwnd,
485 szTemp,
486 pszTitle,
487 uType);
488}
Note: See TracBrowser for help on using the repository browser.