-
February 7th, 2012, 10:45 AM
#1
Hosting Winforms UserControl in CDialog focus problem
Hi,
Im having a problem with focus hosting a winforms usercontrol within an MFC App via a CDialog.
As described in this article
http://msdn.microsoft.com/en-us/library/b1kyh79x.aspx
The usercontrol displays correctly. When I first attempted to select an UI item within the usercontrol, the program hanged.
Within the OnInitDialog of the CDialog I changed it to return false, then it was OK.
I could interact with the controls inside the UserControl correctly.
BOOL CDialogCaseCLR::OnInitDialog()
{
CDialog::OnInitDialog();
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
There are some context menus that bring up dialogs within the user-control when these menuitems are selected, the dialogs never display and it just hangs again like the initial problem?
Cant get my head round what is the problem and what I have to do to solve it?
I did post this in the Visual C++ thread, but told to post it here?
When I break the debugger here is the stack trace
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x93 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.DefWndProc(ref System.Windows.Forms.Message m) + 0xc bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x10e bytes
System.Windows.Forms.dll!System.Windows.Forms.TabControl.WndProc(ref System.Windows.Forms.Message m) + 0x1b6 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x10 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 135, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes
[Native to Managed Transition]
Thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|