Im having problems using data from the host application.
I want to send a string through the dll into the host, then combine it with some data from the host app.
By just including the form in the uses clauses i can use methods to send data into the host, When the data is recived i try to add a lokal variable, this is when i get a access violation:
Host:
procedure TMainForm.DllLink(sMessage: String);
begin
try
//This is ok:
Showmessage(sMessage);
//This is causes Access error:
Showmessage(sMessage +sPid);
except
Showmessage('Access violation');
end;
end;
Dll:
procedure Transfer(sMessage: PChar); stdcall;
var
sMyPid : String;
begin
try
//Get error if i try to use this method to get sPid which is a string:
sMyPid := MainForm.GetPid;
//Or this:
MainForm.NextsysDllLink(sMessage);
except
showmessage('Error');
end;
end;
I dont think the dll is using the running applications forms that is what's causing the access violations (maybe im wrong ?) How do I make the dll aware of a running application(that is its host app.) and use that instance to ether get or manipulate data from itself ?
Im using Delphi 5.