Disappearing help button...
Ron Forrester -- rjf@infograph.com Thursday, May 23, 1996 VC++ 4.0/NT 4.0B2/NT 3.51/95/Win32s I am embedding a dialog box in a CMiniFrameWnd, by called the Create method of a CDialog derived class. In the dialog resource, I added a button with an ID of ID_HELP, so that I could get default help functionality of MFC. However, MFC or Windows (haven't traced deep enough yet) is removing my button ID_HELP when I create/display the dialog. Is it doing this because the dialog is modeless? Can I prevent this from happening? If not, and I rename the button ID_MY_HELP, what should I do to fire the standard help mechanism? I have tried this: m_pMainFrame->PostMessage(WM_COMMAND, MAKEWPARAM(CToolDlg::IDD, ID_HELP), (LPARAM)GetSafeHwnd()); with no luck, the message is thrown out... Any suggestions? Ron
Kanir Pandya -- kpandya@harbinger.net Thursday, May 30, 1996 [Mini-digest: 3 responses] MFC has inbuild mechanism to shut of help buttons for the dialog. If you look at CDialog code in dlgcore.cpp // enable/disable help button automatically CWnd* pHelpButton = GetDlgItem(ID_HELP); if (pHelpButton != NULL) pHelpButton->ShowWindow(AfxHelpEnabled() ? SW_SHOW : SW_HIDE); AfxHelpEnabled checks for if the command is handled by the main frame or by application if it is not it disables the button. You can do following : CYourDialog::OnInitDialog { CDialog::OnInitDialog CWnd* pWnd = GetDlgItem (ID_HELP); if (pWnd) pWnd->ShowWindow(TRUE); return TRUE; } BOOL CSelIndustry::OnHelpInfo(HELPINFO* pHelpInfo) { AfxGetApp()->WinHelp(IDD); return TRUE; //return CDialog::OnHelpInfo(pHelpInfo); } Kanir Pandya Sr. Software Engineer Harbinger Net services 1055, Lenox Park Blvd. Atlanta, GA-30319 Phone : (404) 841-4324 x3152 -----From: Joerg RedeniusI knew this problem from my MSVC 1.52. The cause is an invalid m_HWnd. Turn on your Debug window and switch your tracing on, you'll get the message. Regards Joerg +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + S T N A T L A S E l e k t r o n i k GmbH + + Abt. MET2, Hr. Joerg Redenius + + Sebaldsbruecker Heerstr. 235, 28305 Bremen + + Tel: +49 (0)421-457-3855 FAX: -4171 e-mail: redenius@cae2.atlas.de + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -----From: "Peter A. Vanvliet" The ID_HELP button is tied to the state of the context-sensitive help, or F1 help. So if your class/object that should contain the Help button does not have a handler for the ID_HELP message, the button is hidden. You can step through the MFC message routing for ID_HELP. --------------------------------------------------------------------- Peter A. Vanvliet Houston, Texas pvanvlie@neosoft.com System Analyst, NanoSoft Corporation (http://www.special-events.com) HALPC C++ SIG Leader WWW home page (http://www.special-events.com/cppsig)
| Вернуться в корень Архива |