Sylvain Michaud
June 2nd, 1999, 01:29 PM
Hi,
I have developped sort of addin for our software,
and all work fine if you use C++ for implementation, but with Visual Basic we have some problem.
Some of our interface have usertype defined, example used to test:
typedef struct { long a; long b; } OWNTYPE;
We use this typedef an out parameters.
When we do this, Visual Basic Complain.
Visual Basic seem don`t like this.
QUESTION:
- Can i use typedef struct with Visual Basic?
here a more complete example from idl used to test typedef
EXAMPLE of typedef from an idl:
import "oaidl.idl";
import "ocidl.idl";
typedef struct {
long lEvtID;
BSTR Location;
} EVTDETAIL;
[
object,
uuid(46204BB0-18EB-11D3-B61E-5254ABDD229A),
helpstring("ITestVisualBasic Interface"),
pointer_default(unique)
]
interface ITestVisualBasic : IUnknown
{
[helpstring("method Toto")] HRESULT Toto([in] long tatat);
[helpstring("method Tutu")] HRESULT Tutu([out] long* lNumEvents, [out, size_is(,*lNumEvents)] EVTDETAIL** pevtDet);
};
[
uuid(46204BA3-18EB-11D3-B61E-5254ABDD229A),
version(1.0),
helpstring("testbasic 1.0 Type Library")
]
library TESTBASICLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(46204BB1-18EB-11D3-B61E-5254ABDD229A),
helpstring("TestVisualBasic Class")
]
coclass TestVisualBasic
{
[default] interface ITestVisualBasic;
};
};
Visual Basic complain when i have added the method Tutu.
Is the only solution is to replace all typedef by
Interface that represent this user data type?
Your comment and solution will be appreciate.
I have developped sort of addin for our software,
and all work fine if you use C++ for implementation, but with Visual Basic we have some problem.
Some of our interface have usertype defined, example used to test:
typedef struct { long a; long b; } OWNTYPE;
We use this typedef an out parameters.
When we do this, Visual Basic Complain.
Visual Basic seem don`t like this.
QUESTION:
- Can i use typedef struct with Visual Basic?
here a more complete example from idl used to test typedef
EXAMPLE of typedef from an idl:
import "oaidl.idl";
import "ocidl.idl";
typedef struct {
long lEvtID;
BSTR Location;
} EVTDETAIL;
[
object,
uuid(46204BB0-18EB-11D3-B61E-5254ABDD229A),
helpstring("ITestVisualBasic Interface"),
pointer_default(unique)
]
interface ITestVisualBasic : IUnknown
{
[helpstring("method Toto")] HRESULT Toto([in] long tatat);
[helpstring("method Tutu")] HRESULT Tutu([out] long* lNumEvents, [out, size_is(,*lNumEvents)] EVTDETAIL** pevtDet);
};
[
uuid(46204BA3-18EB-11D3-B61E-5254ABDD229A),
version(1.0),
helpstring("testbasic 1.0 Type Library")
]
library TESTBASICLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(46204BB1-18EB-11D3-B61E-5254ABDD229A),
helpstring("TestVisualBasic Class")
]
coclass TestVisualBasic
{
[default] interface ITestVisualBasic;
};
};
Visual Basic complain when i have added the method Tutu.
Is the only solution is to replace all typedef by
Interface that represent this user data type?
Your comment and solution will be appreciate.