ATL编写的ActiveX有窗口句柄(HWND)?,怎么获得它,请高人指点!!

解决方案 »

  1.   

    How do I get the HWND of my control?This questions is asked several ways. In one example, the developer needed a pointer to the control's HWND to pass when displaying a modal dialog box from within an ActiveX control. Depending on the type of call you can do one of these:If you need an CWnd* pointer, just pass your control's this pointer. COleControl derives from CWnd.If you need a true HWND use COleControl's m_hWnd member. If the control actually has an HWND it will be stored here. You can also use CWnd::GetSafeHwnd(). One caveat though. During the design phase control's don't typically (Unless they are simple frame controls) have an HWND, so you will need to check if m_hWnd is null before using it. If you need to popup a dialog during the design phase, you can pass NULL, which indicates that you want to use the desktop as the parent window.for more details ,see http://www.widgetware.com/faqgen2.htm#hwnd