Hi,
I will be displaying on C# activeX control on one VC++ 6.0 Client.
In the C# activeX control, I will be adding one more VC++ 6.0 developed activex control for the System.Windows.Forms.UserControl.
Here the display and all is fine. When I click on some buttons (belogs VC++ 6.0 developed activeX control), it is working fine also. But, when I click on some buttons(belogs VC++ 6.0 developed activeX control) like it is hanging.
The stack is as shown below
CWnd::GetTopWindow() line 257 + 23 bytes
_AfxNextControl(CWnd * 0x0012f5f4 {CDTMGUICtrlWnd hWnd= }, CWnd * 0x00000000 {CWnd hWnd= }, unsigned int 0) line 90 + 8 bytes
_AfxNextControl(CWnd * 0x0012f58c {CDtmActviexCtrlDlg hWnd= }, CWnd * 0x0012f5f4 {CDTMGUICtrlWnd hWnd= }, unsigned int 0) line 121 + 15 bytes
_AfxRemoveDefaultButton(CWnd * 0x0012f58c {CDtmActviexCtrlDlg hWnd= }, CWnd * 0x01ccccb8 {CTempWnd hWnd=0x00010594}) line 351 + 15 bytes
_AfxCheckDefPushButton(CWnd * 0x0012f58c {CDtmActviexCtrlDlg hWnd= }, CWnd * 0x01cbf3d8 {CTempWnd hWnd=0x00010596}, CWnd * 0x01ccccb8 {CTempWnd hWnd=0x00010594}) line 417
COccManager::IsDialogMessageA(CWnd * 0x0012f58c {CDtmActviexCtrlDlg hWnd= }, tagMSG * 0x00df5080 {msg=0x00000202 wp=0x00000000 lp=0x000a0062}) line 626
CWnd::IsDialogMessageA(tagMSG * 0x00df5080 {msg=0x00000202 wp=0x00000000 lp=0x000a0062}) line 179 + 33 bytes
CWnd::PreTranslateInput(tagMSG * 0x00df5080 {msg=0x00000202 wp=0x00000000 lp=0x000a0062}) line 3435
CDialog::PreTranslateMessage(tagMSG * 0x00df5080 {msg=0x00000202 wp=0x00000000 lp=0x000a0062}) line 92
CWnd::WalkPreTranslateTree(HWND__ * 0x000104d6, tagMSG * 0x00df5080 {msg=0x00000202 wp=0x00000000 lp=0x000a0062}) line 2678 + 18 bytes
CWinThread::PreTranslateMessage(tagMSG * 0x00df5080 {msg=0x00000202 wp=0x00000000 lp=0x000a0062}) line 672 + 18 bytes
CWinThread::PumpMessage() line 848 + 30 bytes
CWnd::RunModalLoop(unsigned long 4) line 3489 + 19 bytes
CDialog::DoModal() line 539 + 12 bytes
CSovSubNetCtrl::OnDTMMenuHandler(unsigned int 34004) line 13117
Please help me in this issue.
Thanks in advance.

Application hangs, when I click on some controls on the ActiveX
Craig Regester
Hi Ayman,
The program falls into infinite loop inside function _AfxRemoveDefaultButton, located in the file occdlg.cpp of MFC. Loop body is provided in my previous mail.
The functions it calls are located a few lines above in the same file.
I have this problem with VC 2005. Right now I have access to VC 2003 and I see the same code. As far as I remember, the first time I face this problem was VC 6.0. Probably, MSVC 4.0 also had this trouble. As far as I remember, I always did some hackery to find a workaround.
In this particular case, it was hanging after I activate the tab via CPropertySheet::SetActivePage(CPropertyPage* pPage), which in the end calls SendMessage(PSM_SETCURSEL, nPage) to the property sheet. I found a workaround by PostMessage(PSM_SETCURSEL, nPage). It helps. But bad feeling still stays - proposed solutions, adding of DS_CONTROL and taking away of WS_EX_CONTROLPARENT styles, do not help.
It appears to me that I'm not alone - just google on function name.
If you need more information - you are welcome.
Regards,
Alexander
Paddylast
Where is _AfxNextControl defined
Thanks, Ayman Shoukry VC++ TeamWilliam R
Thanks Nishanth for trying to help me in this issue.
And I am sorry for bit confusion. Because the situation is bit complicated.
There will be one ActiveX control Developed in VC++ 6.0 (Call it as A).
I have written one System.Windows.Forms.UserControl (Call it as B) developed in C#.
In UserControl (B), I will be getting the ActiveX Control (A) as Control object.
The following is the snippet of the code written in UserControl (B), where I will be getting ActiveX (A) instance as control.
public void AddActControl(object control)
{
m_ctrlActiveX = (Control)control;
Controls.Add(m_ctrlActiveX);
m_ctrlActiveX.Show();
}
The UserControl(B), I am displaying as ActiveX control in VC++ 6.0 code.
In this display is working fine. Only the application is hangs, when I click on some of the buttons(not all the buttons) on the ActiveX control (A).
ActiveX control (A) is working fine in some other applications.
Best Regards,
Nagarjuna
nizzy8
Is that still an issue
Thanks, Ayman Shoukry VC++ TeamBrice FROMENTIN
By C# ActiveX control, I guess you mean a Forms control that you wrote. Does the Forms control work okay in a regular Forms application If you haven't tried that out, do that first and make sure the control works properly before attempting to use CCW on it.
Kevin Farlee
Yes, I did. It is looping at:
do
{
COccManager::SetDefaultButton(pWnd, FALSE);
pWndNext = _AfxNextControl(pWndRoot, pWnd, 0);
pWnd = pWndNext;
}
while ((pWnd != NULL) && (pWnd != pWndStart));
The function _AfxNextControl(pWndRoot, pWnd, 0) always return the same value, not equal to NULL and not equal to pWndStart.
My tab has only one control.
Regards,
Alexander
Dave.H
Have you tried debugging it when it hangs
Thanks, Ayman Shoukry VC++ Teampetegh
I searched but didn't find any reference. May be I am searching on the wrong function name.
If you think that might be a bug in VC, then please log it at http://lab.msdn.microsoft.com/productfeedback/default.aspx with a reproducible sample so that the owners can take a look. Also, please reply back with the link to the bug so that others can follow up on its status.
Thanks in advance for taking the time to report the issue!
Thanks, Ayman Shoukry VC++ TeamMax Iturra
Hi Ayman,
Yes, for me this still an issue.
I have tabbed dialog inside MDI frame with number of tabs. One of the them has an ActiveX control inside. Occasionally, MFC hangs in _AfxRemoveDefaultButton. The tab resource is below:
IDD_TAB_DLG DIALOGEX 0, 0, 308, 122
STYLE DS_SETFONT | DS_CONTROL | WS_CHILD
CAPTION "Tab"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
CONTROL "",IDC_GRID1,"{00028CD1-...}",WS_GROUP |
WS_TABSTOP,3,4,300,114
END
As you see, it has DS_CONTROL style and no WS_EX_CONTROLPARENT extended style. Base dialog also has no last style. And my application still hangs. What can I do
Regards,
Alexander
Houari
Thanks.