Pass Optional Arguments to MFC ActiveX Controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

I have an ActiveX control created by MFC.
One method has the following definition:

[id(1), helpstring("method MyMethod")] SHORT MyMethod(BSTR p1, [optional]
VARIANT p2, [optional] VARIANT p3);

In VB6, I can call this method by the following three ways:

1. MyMethod(p1)
2. MyMethod(p1, p2)
3. MyMethod(p1, p2, p3)

But in VB.NET, only the first and third call can be done.
When I write code like the second one, VS.NET says "Overload resolution
failed because no accessible 'MyMethod' accepts this number of arguments".
It seems I must call this mehod with

MyMethod(p1, p2, Type.Missing)

What's wrong? Or I can not use the second call at all in VB.NET?

Any suggestion will be appreciated.
Thank you in advance.

An
 
Change 'variant' to another type

Me personally have always only ever written non-MFC DLL's in C++ & called
them from VB/VB.NET

What type is the defaults for 'variant'?
 
I thought I remember reading somewhere that DLL's written in MFC aren't
compatible with VB.Net but I could be wrong (I seem to be wrong a lot when it
comes to VB.Net).
 
Back
Top