How to convert IUnknownPtr to Visual Basic 6 ?

Posted on 2005-05-08
Medium Priority
Last Modified: 2013-11-25
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.

Question by:dvplayltd
  • 3
  • 2
  • 2
LVL 55

Accepted Solution

Jaime Olivares earned 900 total points
ID: 13955975
you can pass ByRef Long, but I think you will have problems with the rest of code...

Author Comment

ID: 13955982
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);
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13955988
I have 25 C, 6pm  ;)
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 55

Expert Comment

by:Jaime Olivares
ID: 13955991
Sorry, answering another question...
I will review for a while...

Assisted Solution

_ys_ earned 100 total points
ID: 13973513
Out of interest, what's the VB code section? Maybe what's it's telling you is true.

Author Comment

ID: 13974751
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 ?


Expert Comment

ID: 13992355

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

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question