Hello All,
I am facing this little problem when I want to pass a UDT to a VC dll and modify it.
I have this:
Is my vb declaration wrong? What do i need to do to make it load record properly?
How would I do that in VB? Any ideas?
Please respond with any ideas you might have. Thanks.
-MoMad
I am facing this little problem when I want to pass a UDT to a VC dll and modify it.
I have this:
Code:
// (VC++6.0)
extern "C" {
typedef struct {
BYTE id;
char name[20];
char desc[28];
BYTE params;
} iRec, *LPiRec;
void LoadUdt( BSTR filename, LPVOID theRec ) {
LPCSTR f = (LPCSTR) filename;
LPiRec r = (LPiRec) theRec;
if ( !f ) return;
// First clear the record
memset( r, 0x00, sizeof( iRec ) );
// Now load the file..
// CreateFile if not exist
// Load the contents of the file into theRec via r
// this is only example
r->id = fileid;
r->name = filename;
// ...
// thats all
}
}
// ------------------------------
' VB CODE
Public Sub LoadUdt Lib "<myVc++Lib.dll>" (ByVal filename, ByRef rec as Long)
Is my vb declaration wrong? What do i need to do to make it load record properly?
How would I do that in VB? Any ideas?
Please respond with any ideas you might have. Thanks.
-MoMad