Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing user defined type to a DLL function.

Status
Not open for further replies.

VJunix

Programmer
Oct 29, 2001
2
CL
I have two questions:

1)I need to convert this two struct declaration (in C lenguage) to a "User defined" ( Type Statement) in Visual Basic 6.0

typedef struct{
DWORD size;
BOOL stat1;
char lpszName[15];
DWORD stat2;
}MYST1,*LPMYST1;

typedef struct {
INT num1;
SYSTEMTIME time1;
}MYTIME;

then, i need to pass a variable of type *LPMYST1
to a DLL function :
int function1(HANDLE a,INT b, LPMYST1 lpc)
and the variable of type MYTIME to DLL function:
int function2(HANDLE a,SYSTEMTIME b,MYTIME mt)

2)how can i Declare the above functions in Visual Basic 6.0 Syntax?

Thanks.
 
The best way to use your types is to put them into a class module and them pass them within the class:

MyClassModule
public prop1 as string
public prop2 as ...


Then when calling the function:

dim mytype as new classmodule
myvar.prop1=x
myvar.prop2=y

set somevule=dll.myfunction(mytype)

The gap between theory and practice is not as wide in theory as it is in practice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top