开发者

Why does GetSafeHwnd() return zero in an ActiveX control?

开发者 https://www.devze.com 2023-04-05 07:08 出处:网络
I have developed a MFC Activex control which is windowless and invisible in runtime, while i assumed that basically an acti开发者_开发问答vex is a control that would manipulate a windows handle, i hav

I have developed a MFC Activex control which is windowless and invisible in runtime, while i assumed that basically an acti开发者_开发问答vex is a control that would manipulate a windows handle, i have used GetSafeHwnd() to get windows handle, but unfortunately this method returns zero when it runs. maybe i had set wrong option when creating my activex. how i can create a windowless activex which could manipulate windows hanlde?


By definition, windowless ActiveX control doesn't have a window, and rendered as part of its parent. If you want to work with Windows messages in the control, you can create worker thread with a message loop, and handle any messages there. To have message loop, you don't need a window, just thread. This solution can be implemented in windowless control or in any COM component.

Alternatively, you can use windowed ActiveX control by changing its properties.

0

精彩评论

暂无评论...
验证码 换一张
取 消