CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • ADO.NET Data Services in the .NET Framework
  • Visual C++ Programming: What's new for MFC library in VC++ 2010?
  • Microsoft Visual Studio LightSwitch and What It Can Do For You
  • Displaying Files and Folders in a GridView

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old June 10th, 1999, 08:58 AM
    VuLkaNus VuLkaNus is offline
    Junior Member
     
    Join Date: Jun 1999
    Posts: 5
    VuLkaNus is an unknown quantity at this point (<10)
    HTML Help.

    Anyone know how you can make a html help in your mfc program. I'm not sure I should ask this question this way. If someone knows what i´m talking about and has the answer, then please help.

    Thanks.

    Ólafur Marteinsson
    C/C++ Programmer
    Reply With Quote
      #2    
    Old June 10th, 1999, 12:15 PM
    blarivie blarivie is offline
    Junior Member
     
    Join Date: Apr 1999
    Posts: 3
    blarivie is an unknown quantity at this point (<10)
    Re: HTML Help.

    I did it but the answer is not a short one.
    First, go get the latest Html Help package from http://msdn.microsoft.com/workshop/author/htmlhelp
    Follow the instructions to use HHCtrl.ocx in your project.

    Override WinHelp() in your main frame class and do whatever is done in CWnd::WinHelp but instead of calling ::WinHelp() call your own function which will support HtmlHelp.

    This function could look like this:
    // Explicit linking of HHCtrl.ocx
    typedef HWND (WINAPI* FPHH)(HWND, LPCSTR, UINT, DWORD);
    FPHH g_pHtmlHelp=NULL; // Function pointer

    BOOL CMainFrame::ShowHtmlHelp(DWORD dwData, UINT nCmd)
    {
    BOOL bOK=FALSE;

    // Explicit linking of HHCtrl.ocx
    if (g_pHtmlHelp==NULL)
    {
    HINSTANCE hInstHtmlHelp=LoadLibrary(_T("HHCtrl.ocx"));
    ASSERT(hInstHtmlHelp!=NULL);
    if (hInstHtmlHelp!=NULL)
    (FARPROC&)g_pHtmlHelp=GetProcAddress(hInstHtmlHelp, _T("HtmlHelpA"));
    }

    CString strHtmlHelpFile(GetHtmlHelpFile());
    if ((g_pHtmlHelp!=NULL) && (_access(strHtmlHelpFile, 0)==0))
    {
    HWND hWndResult=NULL;

    CWnd* pWnd = GetDesktopWindow(); // Avoid to have the help window always on top
    if (nCmd==HELP_PARTIALKEY)
    {
    // Keyword (from interpreter documents or Expression Builder)
    HH_AKLINK akLink={
    sizeof(HH_AKLINK), // cbStruct - sizeof this structure
    FALSE, // fReserved - must be FALSE (really!)
    (LPCTSTR)dwData, // pszKeywords - semi-colon separated keywords
    "", // pszUrl - URL to jump to if no keywords found (may be NULL)
    "", // pszMsgText - Message text to display in MessageBox if pszUrl is NULL and no keyword match
    "", // pszMsgTitle - Message text to display in MessageBox if pszUrl is NULL and no keyword match
    "", // pszWindow - Window to display URL in
    TRUE}; // fIndexOnFail - Displays index if keyword lookup fails.

    hWndResult=g_pHtmlHelp( pWnd-&gt;GetSafeHwnd(),
    strHtmlHelpFile,
    HH_KEYWORD_LOOKUP,
    (DWORD)&akLink);
    }
    else if (nCmd==HELP_CONTEXT)
    {
    // Context help (using ID)
    hWndResult=g_pHtmlHelp( pWnd-&gt;GetSafeHwnd(),
    strHtmlHelpFile,
    HH_HELP_CONTEXT,
    dwData);
    if (hWndResult==NULL)
    {
    // Wrong ID: show the index
    hWndResult=g_pHtmlHelp( pWnd-&gt;GetSafeHwnd(),
    strHtmlHelpFile,
    HH_DISPLAY_TOPIC,
    0);
    }

    }
    else
    {
    // Show index
    hWndResult=g_pHtmlHelp( pWnd-&gt;GetSafeHwnd(),
    strHtmlHelpFile,
    HH_DISPLAY_TOPIC,
    0);
    }

    if (hWndResult!=NULL)
    bOK=TRUE;
    }

    return bOK;
    }


    I hope this helps.

    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 11:07 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.