开发者

How to collect Active X controls in the MFC dialog

I know we can enumerate the windows controls with in the dialog and using the callback we can collect the windows controls.

I am looking for specific way to filte开发者_运维技巧ring out the controls based on interface implementation. For example, If the Active-X controls derives from interface IDataControl, I want that to add to my interest collection list.


Here is the generic process to get the ole/active-x controls inside the dialog.

  1. Do EnumWindows with the callback
  2. In the callback, attach the windows handle to CWnd
  3. Try to get IUnknown pointer for the control CWnd::GetControlUnknown
    Tips: How to detect whether a control is standard or active-x control?

  4. If returned IUnknown is not null, do queryInterface for IDataControl.

  5. If IDataControl instance not null, add to collection
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜