PDA

View Full Version : Help with DLL call needed



buntonn
10-17-2003, 06:43 AM
I have a DLL built with C++ which takes a BYREF string and pupulates this with the LOGONSERVER name.

I have added the follownig just above the function

prototype NetworkInformation_debug.LogonServer(BYREF STRING) and have tried this with 'cdecl' after the prototype keyword too.

In the function I have

STRING szDefault[64];

UseDLL ( SUPPORTDIR ^ "NetworkInformation_debug.dll" );

LogonServer(szDefault);

UnUseDLL ( "NetworkInformation_debug.dll" );

The Use and UnUse work fine as i get a messsage box from the DLL to confirm each but when I call the function it throws an error.

Anyone got any ideas on this?

Thanks

Nick

AlexLee
10-17-2003, 10:00 AM
When I use external DLLs, I declare them like:

prototype cdecl LONG DLLName.FunctionName();

do you need the cdecl and the return type (it might be VOID)?

Also - when I call the function, I use:
DLLName.Function();

Alex

buntonn
10-17-2003, 10:16 AM
Alex thanks for the info, I have tried changing the prototype line and I used VOID and the method doesn't return a value. I also added the DLL name infront of the method name on the cal and it still jumps into the catch block on this call. Is it something to do with the BYREF?

Nick

AlexLee
10-17-2003, 10:23 AM
Some of the DLLs I use have BYREF STRING in their parameter list in the prototype, some of the just have STRING...

maybe you need to initialise the string with "" ??

Alex