9 #include "debugtools.h"
12 #include "wine/winuser16.h"
13 #include "wine/winbase16.h"
17 DEFAULT_DEBUG_CHANNEL(win
);
20 /* WinHelp internal structure */
31 /**********************************************************************
34 BOOL16 WINAPI
WinHelp16( HWND16 hWnd
, LPCSTR lpHelpFile
, UINT16 wCommand
,
40 /* We might call WinExec() */
41 ReleaseThunkLock( &mutex_count
);
43 if (!(ret
= WinHelpA( WIN_Handle32(hWnd
), lpHelpFile
, wCommand
, (DWORD
)MapSL(dwData
) )))
45 /* try to start the 16-bit winhelp */
46 if (WinExec( "winhelp.exe -x", SW_SHOWNORMAL
) >= 32)
49 ret
= WinHelpA( WIN_Handle32(hWnd
), lpHelpFile
, wCommand
, (DWORD
)MapSL(dwData
) );
53 RestoreThunkLock( mutex_count
);
58 /**********************************************************************
61 BOOL WINAPI
WinHelpA( HWND hWnd
, LPCSTR lpHelpFile
, UINT wCommand
,
64 static WORD WM_WINHELP
= 0;
73 WM_WINHELP
=RegisterWindowMessageA("WM_WINHELP");
78 hDest
= FindWindowA( "MS_WINHELP", NULL
);
80 if(wCommand
== HELP_QUIT
) return TRUE
;
81 if (WinExec ( "winhlp32.exe -x", SW_SHOWNORMAL
) < 32) {
82 ERR("can't start winhlp32.exe -x ?\n");
85 if ( ! ( hDest
= FindWindowA ( "MS_WINHELP", NULL
) )) {
86 FIXME("did not find MS_WINHELP (FindWindow() failed, maybe global window handling still unimplemented)\n");
95 case HELP_SETCONTENTS
:
97 case HELP_CONTEXTPOPUP
:
105 case HELP_PARTIALKEY
:
107 dsize
= dwData
? strlen( (LPSTR
)dwData
)+1: 0;
110 dsize
= ((LPMULTIKEYHELPA
)dwData
)->mkSize
;
113 dsize
= ((LPHELPWININFOA
)dwData
)->wStructSize
;
116 FIXME("Unknown help command %d\n",wCommand
);
120 nlen
= strlen(lpHelpFile
)+1;
123 size
= sizeof(WINHELP
) + nlen
+ dsize
;
124 hwh
= GlobalAlloc16(0,size
);
125 lpwh
= GlobalLock16(hwh
);
127 lpwh
->command
= wCommand
;
130 strcpy(((char*)lpwh
) + sizeof(WINHELP
),lpHelpFile
);
131 lpwh
->ofsFilename
= sizeof(WINHELP
);
133 lpwh
->ofsFilename
= 0;
135 memcpy(((char*)lpwh
)+sizeof(WINHELP
)+nlen
,(LPSTR
)dwData
,dsize
);
136 lpwh
->ofsData
= sizeof(WINHELP
)+nlen
;
140 return SendMessage16(hDest
,WM_WINHELP
,hWnd
,hwh
);
144 /**********************************************************************
145 * WinHelpW (USER32.@)
147 BOOL WINAPI
WinHelpW( HWND hWnd
, LPCWSTR helpFile
, UINT command
,
150 LPSTR file
= HEAP_strdupWtoA( GetProcessHeap(), 0, helpFile
);
151 BOOL ret
= WinHelpA( hWnd
, file
, command
, dwData
);
152 HeapFree( GetProcessHeap(), 0, file
);