J
JB
I have a function in a DLL which displays a message and sets a return
value;
//Function in DLL
function ShowMsg(pMsg : PChar) : Word; stdcall;
var
Msg : string;
res : word;
sres : string;
begin
Msg := StrPas(pMsg);
self.Edit1.text := msg;
self.ShowModal; // Show my message
res := 137;
sres := IntToStr(res);
ShowMessage(sres); // Show my function result value
result := res;
end;
and I call that function from VB.net as;
'Call function in DLL
Dim target As Object = Activator.CreateInstance(t)
res = t.InvokeMember("ShowMsg", BindingFlags.InvokeMethod Or
BindingFlags.Static Or BindingFlags.Public, Nothing, target, args)
MsgBox(res) ' Show my function result value
Now whenever I run that function it calls the DLL displays the
message, it then displays the result value (137 in this example), it
then returns to vb.net and displays the function result value as 0.
It does this even if I explicitly cast the result to an integer or
int16 value.
Can anyone explain to me why this does not get the return value out of
the DLL?
TIA
value;
//Function in DLL
function ShowMsg(pMsg : PChar) : Word; stdcall;
var
Msg : string;
res : word;
sres : string;
begin
Msg := StrPas(pMsg);
self.Edit1.text := msg;
self.ShowModal; // Show my message
res := 137;
sres := IntToStr(res);
ShowMessage(sres); // Show my function result value
result := res;
end;
and I call that function from VB.net as;
'Call function in DLL
Dim target As Object = Activator.CreateInstance(t)
res = t.InvokeMember("ShowMsg", BindingFlags.InvokeMethod Or
BindingFlags.Static Or BindingFlags.Public, Nothing, target, args)
MsgBox(res) ' Show my function result value
Now whenever I run that function it calls the DLL displays the
message, it then displays the result value (137 in this example), it
then returns to vb.net and displays the function result value as 0.
It does this even if I explicitly cast the result to an integer or
int16 value.
Can anyone explain to me why this does not get the return value out of
the DLL?
TIA