Check if winhelp is already running; use winhlp32.exe or winhelp.exe

depending on the emulated version, relase win16lock before calling
WinHelpA.
This commit is contained in:
Peter Ganten 2000-01-05 02:41:12 +00:00 committed by Alexandre Julliard
parent c8f1f5e4eb
commit 65b1f9f0f0
1 changed files with 29 additions and 21 deletions

View File

@ -9,8 +9,10 @@
#include "debugtools.h" #include "debugtools.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "winversion.h"
#include "heap.h" #include "heap.h"
#include "ldt.h" #include "ldt.h"
#include "syslevel.h"
DEFAULT_DEBUG_CHANNEL(win) DEFAULT_DEBUG_CHANNEL(win)
@ -21,8 +23,12 @@ DEFAULT_DEBUG_CHANNEL(win)
BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand, BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand,
DWORD dwData ) DWORD dwData )
{ {
return WinHelpA( hWnd, lpHelpFile, wCommand, BOOL ret;
(DWORD)PTR_SEG_TO_LIN(dwData) ); /* We might call WinExec() */
SYSLEVEL_ReleaseWin16Lock();
ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)PTR_SEG_TO_LIN(dwData) );
SYSLEVEL_RestoreWin16Lock();
return ret;
} }
@ -36,32 +42,34 @@ BOOL WINAPI WinHelpA( HWND hWnd, LPCSTR lpHelpFile, UINT wCommand,
HWND hDest; HWND hDest;
LPWINHELP lpwh; LPWINHELP lpwh;
HGLOBAL16 hwh; HGLOBAL16 hwh;
HINSTANCE winhelp;
int size,dsize,nlen; int size,dsize,nlen;
if (wCommand != HELP_QUIT) /* FIXME */
{
if (WinExec("winhelp.exe -x",SW_SHOWNORMAL) <= 32)
return FALSE;
/* NOTE: Probably, this should be directed yield,
to let winhelp open the window in all cases. */
Yield16();
}
if(!WM_WINHELP) if(!WM_WINHELP)
{ {
WM_WINHELP=RegisterWindowMessageA("WM_WINHELP"); WM_WINHELP=RegisterWindowMessageA("WM_WINHELP");
if(!WM_WINHELP) if(!WM_WINHELP)
return FALSE; return FALSE;
} }
hDest = FindWindowA( "MS_WINHELP", NULL ); hDest = FindWindowA( "MS_WINHELP", NULL );
if(!hDest) if(!hDest) {
{ if(wCommand == HELP_QUIT)
if(wCommand == HELP_QUIT) return TRUE;
return TRUE; else
else if ( VERSION_GetVersion() == WIN31 ) {
return FALSE; winhelp = WinExec ( "winhelp.exe -x", SW_SHOWNORMAL );
Yield16();
}
else {
winhelp = WinExec ( "winhlp32.exe -x", SW_SHOWNORMAL );
}
if ( winhelp <= 32 ) return FALSE;
if ( ! ( hDest = FindWindowA ( "MS_WINHELP", NULL ) )) return FALSE;
} }
switch(wCommand) switch(wCommand)
{ {
case HELP_CONTEXT: case HELP_CONTEXT: