views:

46

answers:

1

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 filtering 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.

A: 

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: http://stackoverflow.com/questions/2536165/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
Gopalakrishnan Subramani