We help IT Professionals succeed at work.
Get Started

How to access IDispatch pointer for an activex control instead of using ctrl wrapper classes

Last Modified: 2013-11-20

I want to access a custom activex control I created, lets call it MyControl through the IDispatch method.  Sometimes adding the wrapper class to the main app dialog does not show new put and set funcs which correspond to properties added to the control.

So in my dialog .cpp  file in the main app, which includes MyControl in the dialog.
1\  What do I have to include to access my activex control?  I have tried to include the ctrl class header file from my activex control project, that does not work.  Also, do I include the tlb file?

Then later in the file in func OnInitDialog()

CWnd* m_Wnd;
IUnknown* m_iUnknown;
CMyControlCtrl   m_activex;    \\class is my control class within my activex control

m_Wnd = GetDlgItem(IDC_MYCONTROLCTRL1);   \\get the control id for my activex control on the dialog

2\  What is the correct way to do the query inerface with the first input parameter? the func def takes, REFIID riid as the first parameter.

m_iUnknown->QueryInterface(????, (LPVOID*) &m_activex);

Once I have done the correct query I should be able to access the control through

Thanks in Advance!
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE