winhelp: Properly quit winhelp when no file are given on command line.

This commit is contained in:
Eric Pouech 2008-06-21 10:50:26 +02:00 committed by Alexandre Julliard
parent 0674e61955
commit 25b79fafe3
1 changed files with 10 additions and 0 deletions

View File

@ -376,6 +376,13 @@ typedef struct
WORD ofsData; WORD ofsData;
} WINHELP,*LPWINHELP; } WINHELP,*LPWINHELP;
static BOOL WINHELP_HasWorkingWindow(void)
{
if (!Globals.active_win) return FALSE;
if (Globals.active_win->next || Globals.win_list != Globals.active_win) return TRUE;
return Globals.active_win->page != NULL && Globals.active_win->page->file != NULL;
}
/****************************************************************** /******************************************************************
* WINHELP_HandleCommand * WINHELP_HandleCommand
* *
@ -407,6 +414,7 @@ static LRESULT WINHELP_HandleCommand(HWND hSrcWnd, LPARAM lParam)
{ {
MACRO_JumpContext(ptr, "main", wh->data); MACRO_JumpContext(ptr, "main", wh->data);
} }
if (!WINHELP_HasWorkingWindow()) MACRO_Exit();
break; break;
case HELP_QUIT: case HELP_QUIT:
MACRO_Exit(); MACRO_Exit();
@ -416,9 +424,11 @@ static LRESULT WINHELP_HandleCommand(HWND hSrcWnd, LPARAM lParam)
{ {
MACRO_JumpContents(ptr, "main"); MACRO_JumpContents(ptr, "main");
} }
if (!WINHELP_HasWorkingWindow()) MACRO_Exit();
break; break;
case HELP_HELPONHELP: case HELP_HELPONHELP:
MACRO_HelpOn(); MACRO_HelpOn();
if (!WINHELP_HasWorkingWindow()) MACRO_Exit();
break; break;
/* case HELP_SETINDEX: */ /* case HELP_SETINDEX: */
case HELP_SETCONTENTS: case HELP_SETCONTENTS: