Do not clear the drawing area for etched static controls.
[wine.git] / windows / winhelp.c
blob517169a35eaed52287a165aeae3b050bc95bf0a7
1 /*
2 * Windows Help
3 */
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include <unistd.h>
9 #include "debugtools.h"
10 #include "wine/winuser16.h"
11 #include "wine/winbase16.h"
12 #include "heap.h"
13 #include "ldt.h"
15 DEFAULT_DEBUG_CHANNEL(win)
18 /**********************************************************************
19 * WinHelp16 (USER.171)
21 BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand,
22 DWORD dwData )
24 return WinHelpA( hWnd, lpHelpFile, wCommand,
25 (DWORD)PTR_SEG_TO_LIN(dwData) );
29 /**********************************************************************
30 * WinHelp32A (USER32.579)
32 BOOL WINAPI WinHelpA( HWND hWnd, LPCSTR lpHelpFile, UINT wCommand,
33 DWORD dwData )
35 static WORD WM_WINHELP = 0;
36 HWND hDest;
37 LPWINHELP lpwh;
38 HGLOBAL16 hwh;
39 int size,dsize,nlen;
40 if (wCommand != HELP_QUIT) /* FIXME */
42 if (WinExec("winhelp.exe -x",SW_SHOWNORMAL) <= 32)
43 return FALSE;
45 /* NOTE: Probably, this should be directed yield,
46 to let winhelp open the window in all cases. */
47 Yield16();
50 if(!WM_WINHELP)
52 WM_WINHELP=RegisterWindowMessageA("WM_WINHELP");
53 if(!WM_WINHELP)
54 return FALSE;
57 hDest = FindWindowA( "MS_WINHELP", NULL );
58 if(!hDest)
60 if(wCommand == HELP_QUIT)
61 return TRUE;
62 else
63 return FALSE;
65 switch(wCommand)
67 case HELP_CONTEXT:
68 case HELP_SETCONTENTS:
69 case HELP_CONTENTS:
70 case HELP_CONTEXTPOPUP:
71 case HELP_FORCEFILE:
72 case HELP_HELPONHELP:
73 case HELP_FINDER:
74 case HELP_QUIT:
75 dsize=0;
76 break;
77 case HELP_KEY:
78 case HELP_PARTIALKEY:
79 case HELP_COMMAND:
80 dsize = strlen( (LPSTR)dwData )+1;
81 break;
82 case HELP_MULTIKEY:
83 dsize = ((LPMULTIKEYHELP)dwData)->mkSize;
84 break;
85 case HELP_SETWINPOS:
86 dsize = ((LPHELPWININFO)dwData)->wStructSize;
87 break;
88 default:
89 WARN("Unknown help command %d\n",wCommand);
90 return FALSE;
92 if(lpHelpFile)
93 nlen = strlen(lpHelpFile)+1;
94 else
95 nlen = 0;
96 size = sizeof(WINHELP) + nlen + dsize;
97 hwh = GlobalAlloc16(0,size);
98 lpwh = GlobalLock16(hwh);
99 lpwh->size = size;
100 lpwh->command = wCommand;
101 lpwh->data = dwData;
102 if(nlen) {
103 strcpy(((char*)lpwh) + sizeof(WINHELP),lpHelpFile);
104 lpwh->ofsFilename = sizeof(WINHELP);
105 } else
106 lpwh->ofsFilename = 0;
107 if(dsize) {
108 memcpy(((char*)lpwh)+sizeof(WINHELP)+nlen,(LPSTR)dwData,dsize);
109 lpwh->ofsData = sizeof(WINHELP)+nlen;
110 } else
111 lpwh->ofsData = 0;
112 GlobalUnlock16(hwh);
113 return SendMessage16(hDest,WM_WINHELP,hWnd,hwh);
117 /**********************************************************************
118 * WinHelp32W (USER32.580)
120 BOOL WINAPI WinHelpW( HWND hWnd, LPCWSTR helpFile, UINT command,
121 DWORD dwData )
123 LPSTR file = HEAP_strdupWtoA( GetProcessHeap(), 0, helpFile );
124 BOOL ret = WinHelpA( hWnd, file, command, dwData );
125 HeapFree( GetProcessHeap(), 0, file );
126 return ret;