c++ - How to map help id of a error messagebox in MFC? -
i have dialog box in mfc has button. able map button content.
on dialog box, have edit box user can enter anything. validating edit control box if wrong user enters open error message box display error , having button too.
i wanted map error message box helpid content (which different parent dialog box) whenever click button shows me parent content.
note: tried both apis afxmessagebox , messagebox.
solution side , (i don't know if correct ) create dialog box , mapp id di fro parent dialog box. , treat dialog box error messagebox domodal.
i feel can messagebox didn't find on web.
what tried -
i tried following link couldn't success. http://www.codeproject.com/articles/562/add-a-help-button-to-a-messagebox
void callback msgboxcallback(lphelpinfo lphelpinfo) { cstring str = afxgetapp()->m_pszhelpfilepath; afxgetapp()->winhelp(lphelpinfo->dwcontextid); } uint afxmessagebox(hwnd hwnd, lpctstr sztext, uint ntype, uint nidhelp = 0) { msgboxparams mbp; memset(&mbp, 0, sizeof mbp); mbp.cbsize = sizeof msgboxparams; mbp.hwndowner = hwnd; mbp.hinstance = afxgetinstancehandle(); mbp.lpsztext = sztext; afxgetapp()->m_pszhelpfilepath = "c:\\program files (x86)\\\help\\130.htm"; // if wanted specify different caption, here mbp.lpszcaption = afxgetappname(); // if id not 0, add button if (nidhelp != 0) { mbp.dwstyle = ntype | mb_help; } else { mbp.dwstyle = ntype; } // mbp.lpszicon = ; // note, provide own custom icon here! mbp.dwcontexthelpid = nidhelp; mbp.lpfnmsgboxcallback = &msgboxcallback; mbp.dwlanguageid = 0x0409; return ::messageboxindirect(&mbp); }
here's how it:
create string resource each message box.
be sure name resource
idp_
prefix. althoughids_
corresponds strings,makehm
command-line tool notids_
when builds htmldefines.h file.change message box call(s)
afxmessagebox(idp_foo, mb_ok|mb_help, idp_foo)
, substituting in other flags, needed.
(note: had answer, way off, decided start clean new answer instead of updating it.)
Comments
Post a Comment