[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

"Content" Tab on Help interface...

I have a MFC program which uses the CWinApp::WinHelp function to lauch help.
I notice that there are three tabs/pages on that property-sheet namely Contents, Index and Find.
How can I set the Contents tab/page as the default whenever the help is called using the WinHelp function?
0
baigmz
Asked:
baigmz
  • 4
1 Solution
 
mjswartCommented:
Instead of using CWinApp::WinHelp, you might use ::WinHelp which has a parameter uCommand which allows you to set the proper tab.

Mike Swart
0
 
baigmzAuthor Commented:
Thanks for suggestion.
My orginial code looked like this:
(AfxGetApp())->WinHelp ((DWORD)key, HELP_PARTIALKEY);

I re-wrote it as shown below after reading your suggestion:

CString strPath = AfxGetApp()->m_pszHelpFilePath;
BOOL bDone = ::WinHelp(m_hWnd, strPath, HELP_PARTIALKEY, 0);
ASSERT(bDone != FALSE);

The problem is, when I do the ::WinHelp
call with the HELP_PARTIALKEY as the 3rd
parameter, I get the property-sheet with the 3 tabs (Contents, Index, Find). This doesn't really help as the focus always turns out to be on the Index tab. But if I use the HELP_CONTENTS instead, I get the general help window from where I will have to lauch the sheet dialog manually.

I want to use ::WinHelp to lauch the help sheet directly with the default focus always set on the Contents tab. How is this coded? Thanks in advance.
0
 
mjswartCommented:
Sorry I can't help, reject and let someone else have a go at it.
Mike
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
mjswartCommented:
The closest I can come up with is:
::WinHelp(NULL,
   "c:/Something.hlp",
   HELP_FINDER,
   0);

Which will bring up the contents if that screen was last exited with the contents visible.
0
 
jclanzCommented:
Hello,
I have gived this response to an other question to add Help in property sheet. Probably a part of the answer for your question is in this code.

...H
//{{AFX_MSG(CSheet)
//}}AFX_MSG
afx_msg void OnHelp();
afx_msg LRESULT OnCommandHelp(WPARAM, LPARAM);

...CPP
BEGIN_MESSAGE_MAP(CSheet, CPropertySheet)
//{{AFX_MSG_MAP(CSheet)
//}}AFX_MSG_MAP
ON_COMMAND(ID_HELP, OnHelp)
ON_MESSAGE(WM_HELP, OnCommandHelp)
END_MESSAGE_MAP()

void CSheet::OnHelp()
{
// for the "Help" button
theApp.WinHelp(HID_BASE_RESOURCE + IDD_PROPERTY_DIALOG, HELP_CONTEXT);
}

LRESULT CSheet::OnCommandHelp(WPARAM wParam, LPARAM lParam)
{
  // for context help
  HELPINFO *pHelpInfo = (HELPINFO*)lParam;
  UINT nID = pHelpInfo->iCtrlId;
  UINT uCommand = HELP_CONTEXTPOPUP;
  switch (nID)
  {
    case AFX_IDC_TAB_CONTROL:
    {
      CPage *pPage = (CPage*)GetActivePage();
      nID = HID_BASE_RESOURCE + pPage->GetHelpID();
      uCommand = HELP_CONTEXT;
      break;
    }
    case IDOK:
    case IDCANCEL:
    case ID_APPLY_NOW:
    case ID_HELP:
      nID = HID_BASE_RESOURCE + IDD_PROPERTY_DIALOG;
      uCommand = HELP_CONTEXT;
      break;
    default:
      nID = HID_BASE_CONTROL + nID;
      break;
  }
  theApp.WinHelp(nID, uCommand);
  return 0;
}

regards, jean-claude.
jclanz@bluewin.ch
0
 
mjswartCommented:
This doesn't address the problem I think.
your code snippet details how to launch help.
baigmz is able to launch help, just not able to specify the contents tab.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now