Link to home
Start Free TrialLog in
Avatar of dvplayltd
dvplayltdFlag for Bulgaria

asked on

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.

ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dvplayltd

ASKER

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);
I have 25 C, 6pm  ;)
Sorry, answering another question...
I will review for a while...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 ?


Avatar of _ys_
_ys_

FYI,

VB object is equivalent to C++ [/COM] IDispatch interface.