CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2005
    Posts
    125

    htmlhelp API pressing the cancel button

    Hi Forum

    I have the following code ...

    Code:
            hHtmlHelp = HtmlHelp( hWndHandle,
                                  szHelpFileName,
                                  uiHelpCommand, 
                                  (DWORD)&link);
        if (hHtmlHelp==NULL) {
            MessageBox(hMainWnd,"Internal Help error"...... etc
    This API displays the Topics found and then when I press the Display after selecting the topic. displays the HTML help for that topic

    But
    If I press Cancel on the "Topic Found" dialog box, then my program enters this if Condition..
    I notice that even If I press CANCEL button, the 'hHtmlHelp' variable remains NULL.

    Question :
    How to detect if the user has pressed the cancel button instead of any other error ..

    Thanks in Advance
    Soft
    Last edited by softmessager; January 31st, 2012 at 12:53 AM. Reason: Spelling mistakes

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: htmlhelp API pressing the cancel button

    Did you try HH_GET_LAST_ERROR command?
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2005
    Posts
    125

    Re: htmlhelp API pressing the cancel button

    The Syntax for HtmlHelp says

    BOOL HtmlHelp( HWND hWndMain, LPCTSTR lpszHelp,
    UINT uCommand, DWORD dwData )

    .. and our program uses the following options while callin the help in uCommand ..
    HH_KEYWORD_LOOKUP
    HH_HELP_FINDER etc


    I do not know how the HH_GET_LAST_ERROR fits in.
    MSDN shows a different example of HtmlHelp
    http://support.microsoft.com/kb/297768
    I recon that this is a very old example of the API.

    Eiter I will have to change my archiecture of the program (working fine till now) or I may be missing something in the syntax.

    Thanks for responding ..

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: htmlhelp API pressing the cancel button

    Quote Originally Posted by softmessager View Post
    The Syntax for HtmlHelp says

    BOOL HtmlHelp( HWND hWndMain, LPCTSTR lpszHelp,
    UINT uCommand, DWORD dwData )
    Where did you find such a "syntax"?
    According to MSDN the HtmlHelp signature is
    Code:
    HWND HtmlHelp(
                  HWND    hwndCaller,
                  LPCSTR  pszFile,
                  UINT    uCommand,
                  DWORD   dwData) ;
    Victor Nijegorodov

  5. #5
    Join Date
    Apr 2005
    Posts
    125

    Re: htmlhelp API pressing the cancel button

    Oops : My Bad
    You are right.

    I should have atleast looked in my code
    Any exapmple? . or piece of code on how to use the HH_GET_LAST_ERROR

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: htmlhelp API pressing the cancel button

    Quote Originally Posted by softmessager View Post
    Any exapmple? . or piece of code on how to use the HH_GET_LAST_ERROR
    But you already posted a link to http://support.microsoft.com/kb/297768 with such an example!
    Victor Nijegorodov

  7. #7
    Join Date
    Apr 2005
    Posts
    125

    Re: htmlhelp API pressing the cancel button

    The syntax is different

    See what I Quoted about uCommand ..
    HH_KEYWORD_LOOKUP
    HH_HELP_FINDER etc

    But as per the example in the link i gave, the third parameter is HH_GET_LAST_ERROR

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: htmlhelp API pressing the cancel button

    Quote Originally Posted by softmessager View Post
    The syntax is different

    See what I Quoted about uCommand ..
    HH_KEYWORD_LOOKUP
    HH_HELP_FINDER etc

    But as per the example in the link i gave, the third parameter is HH_GET_LAST_ERROR
    If the call of HtmlHelp with one of your parameters (HH_KEYWORD_LOOKUP, HH_HELP_FINDER, etc ) failed (return value is NULL) then call HtmlHelp with HH_GET_LAST_ERROR exactly as it was suggested in Microfoft example in http://support.microsoft.com/kb/297768
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured