How to convert IUnknownPtr to Visual Basic 6 ?

Hello experts !

I has ActiveX DLL, that is used from MS Visual C++. Here is fragment of code:
IUnknownPtr punkSource;
      hr = m_pBridge->InsertSourceFilter(m_pSourceGraphSinkFilter, m_pCaptureGraph, &punkSource);
      IBaseFilterPtr pfSource = punkSource;
In it "m_pBridge" is ActiveX, that I MUST use from VB 6.

What type to use in VB6 so I can not get run time error 13 - "Type mismatch?" due to type of punkSource ? I has try Object, Variant but NO susess :(

Any help will be OK.

Who is Participating?
Jaime OlivaresConnect With a Mentor Software ArchitectCommented:
you can pass ByRef Long, but I think you will have problems with the rest of code...
dvplayltdAuthor Commented:
No, tyring to pass Long type do NOT work. At compile time VB 6 says "ByRef argument type mishmash".
Here is declaration at function of ActiveX that I must call from VB 6. I hope this will provide you with necassery info .

      HRESULT InsertSourceFilter(
                        [in] IUnknown* pUnkSourceGraphSinkFilter,
                        [in] IUnknown* pRenderGraph,
                        [out, retval] IUnknown** ppFilter);
Jaime OlivaresSoftware ArchitectCommented:
I have 25 C, 6pm  ;)
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Jaime OlivaresSoftware ArchitectCommented:
Sorry, answering another question...
I will review for a while...
_ys_Connect With a Mentor Commented:
Out of interest, what's the VB code section? Maybe what's it's telling you is true.
dvplayltdAuthor Commented:
For _ys_

I think that I know where the problem is, however I do NOT know what is exact solution. I am experience Visual Basic project leader that use hard code VB with many API, objects, Polymorphism and so on.

The problem is when punkSource (...[out, retval] IUnknown** ppFilter...) is return to VB. It is pointer to custom object that has NO equivalent in VB. Since i just need to pass it to others metod in same ActiveX I do NOT care what it is :) But VB require to know it type :)

For me is important to inderstand what actyaly contain 3 param (at hr = m_pBridge->InsertSourceFilter(m_pSourceGraphSinkFilter, m_pCaptureGraph, &punkSource) ) ?
Long (int in C++) to memory address where is object ? Or somethink other ? If I print ppFilter what I will see - adress where is object    or    adress where is long value that conatain memory address ?


VB object is equivalent to C++ [/COM] IDispatch interface.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.