"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?
baigmzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.