VB doesn't provide an HWND to OLE Controls? How to get it for an MFC OCX?
-
The hWnd of the instance of my OCX Control is always 0x00000000! So I am unable to PostMessage() withing my control. Nothing works... Even GetActualParent() as posted in the MSDN... If anyone has encountered anything similar, or have an idea to get around this, please reply back as I'm stuck over this for more than 24 hours now! :(:confused: Thanks, Nirav Doshi
-
The hWnd of the instance of my OCX Control is always 0x00000000! So I am unable to PostMessage() withing my control. Nothing works... Even GetActualParent() as posted in the MSDN... If anyone has encountered anything similar, or have an idea to get around this, please reply back as I'm stuck over this for more than 24 hours now! :(:confused: Thanks, Nirav Doshi
I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor as many times I do :-(
-
I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor as many times I do :-(
Hi Pradeep, Pradeep Maskeri wrote: I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor Thanks for your reply! My OCX is a wrapper for a hardware device - And doesn't need to create any window. So, I'm not handling WM_CREATE! Now, if you make a similar OCX using MFC, and put it in a VB Form... Then try to debug the OCX code by making the VBClient.EXE with your OCX embedded in the VB Form, you can see that the OCX control's HWND is ALWAYS 0x00000000! But if you insert the control in the ActiveX Test Container or another VC++ (MFC) client app, and then you debug your OCX code, you will see the OCX control's HWND has a legitimate value. This is the problem, I have! :-(( - Nirav
-
Hi Pradeep, Pradeep Maskeri wrote: I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor Thanks for your reply! My OCX is a wrapper for a hardware device - And doesn't need to create any window. So, I'm not handling WM_CREATE! Now, if you make a similar OCX using MFC, and put it in a VB Form... Then try to debug the OCX code by making the VBClient.EXE with your OCX embedded in the VB Form, you can see that the OCX control's HWND is ALWAYS 0x00000000! But if you insert the control in the ActiveX Test Container or another VC++ (MFC) client app, and then you debug your OCX code, you will see the OCX control's HWND has a legitimate value. This is the problem, I have! :-(( - Nirav
Oh! It is windowless. So this may help http://www.kbalertz.com/Feedback\_153582.aspx I hope sincerely