|
| Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free! |
MFC dialogs ActiveX help please
|
Original Message
|
Name: adam berger
Date: September 12, 2002 at 18:28:36 Pacific
Subject: MFC dialogs ActiveX help please OS: WindowsXP CPU/Ram: Athalon 1GHz/128MB
|
Comment: hi, i am an experienced C++ and WinAPI programmer, but this is my first experience with MFC and VisualC++. I tried to add ActiveX controls like a WebBrowser or a RichEdit Control to a dialog that is called in CWinApp::InitInstance in response to the EndDialog(1) call on a first, signon dialog. However, I get an assertion failure in void*& CMapPtrToPtr::operator[](void* key) in map_pp.cpp. The dialog works fine without the controls. what could be causing this and how can I fix it? please help.
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Jeff J
Date: September 13, 2002 at 09:19:27 Pacific
|
Reply: (edit)If you haven't already done so, try isolating one control at a time, and seeing which is the culprit, if not both. The failed assertion is probably for: ASSERT_VALID(this); This suggests that an instance of CMapPtrToPtr is not valid (but not necessarily NULL; look at what AfxAssertValidObject checks, which is how ASSERT_VALID is #defined). Trace back on the call stack to where the subscript operator is first used on your CMapPtrToPtr object, to get a better idea of what's wrong. You never mentioned how you were incorporating the controls into your project, and that might provide further clues. Also, which version of VC and the controls?
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: adam
Date: September 13, 2002 at 15:25:32 Pacific
|
Reply: (edit)The error is caused by a failed assertion, marked below. This is in response to some message, exactly which one i have been unable to determine. I am using VC++ 6.0 and have a dialog-based app with all controls added to the dialog graphically in resources. the relevant callstack is pasted below the following code. Also, i was pleasantly surprised by the speed with which you responded to my question. Thank you very much. LRESULT CALLBACK AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { // special message which identifies the window as using AfxWndProc if (nMsg == WM_QUERYAFXWNDPROC) return 1; // all other messages route through message map CWnd* pWnd = CWnd::FromHandlePermanent(hWnd); /////////////////////////////////////////// //following assertion of pWnd fails ASSERT(pWnd != NULL); ASSERT(pWnd->m_hWnd == hWnd); return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam); } NTDLL! 77f7f570() _CrtDbgReport(int 0x00000002, const char * 0x5f4cccf0 THIS_FILE, int 0x0000016d, const char * 0x00000000, const char * 0x00000000) line 353 AfxAssertFailedLine(const char * 0x5f4cccf0 THIS_FILE, int 0x0000016d) line 39 + 20 bytes AfxWndProc(HWND__ * 0x0010036c, unsigned int 0x0000001f, unsigned int 0x00000000, long 0x00000000) line 365 + 21 bytes AfxWndProcBase(HWND__ * 0x0010036c, unsigned int 0x0000001f, unsigned int 0x00000000, long 0x00000000) line 220 + 21 bytes
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: Jeff J
Date: September 13, 2002 at 20:38:56 Pacific
|
Reply: (edit)The problem is not at that point, but earlier somewhere. The failing assertion is only saying that FromHandlePermanent was not able to find a CWnd object for the hWnd passed into the window procedure (not a recognised MFC handle in your app). Did you try removing each control and seeing which one causes problems? The message is WM_CANCELMODE (0x1F), according to the trace. It is probably related to the dialog opening. Without knowing how the controls are integrated into the app, it is difficult to know why the handle is unknown to the app. Do the controls have any message map entries (look below BEGIN_MESSAGE_MAP macro)?
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: adam
Date: September 18, 2002 at 12:22:39 Pacific
|
Reply: (edit)thank you for all of your help. I overrode the OnCancelMode handler and did not call CDialog::OnCancelMode and the dialog works fine. i don't know what cancel mode does, but it doesnt seem to be affecting the application. i have an OnBnClicked for one button in the dialog.
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
Name: Jeff J
Date: September 18, 2002 at 20:27:31 Pacific
|
Reply: (edit)Glad to hear it. I don't think you'll miss OnCancelMode, since its main purpose is just to give the window underneath the new dialog, a chance to cancel special stuff like if mouse-capturing was set for it. 99% of situations probably never need it. Cheers
Report Offensive Follow Up For Removal
|

Post Locked
This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
Go to Programming Forum Home
|
|
|