the task is very common and I though it is very easy to complete. But after 3 hours of googling I have gave up.
I have to pass string from MS Access VBA macros to Delphi DLL to operate with the string inside Delphi DLL.
Enviroment: Delphi 2010, Access 2010
I also want to avoid using of ShareMem.
What I do:
Access:
Option Compare Database
Private Declare Function callForm Lib "C:\Programing\_contract\MyWork_2014\AccessDLL\build\access.dll" (ByRef par As Variant) As Long
Private Sub Button0_Click()
MsgBox callForm("alex")
End Sub
Delphi DLL:
function callForm(par: PChar): Integer; export; stdcall;
var
buf: PWideChar;
s: String;
rs: RawByteString;
begin
frmAccessTest.Caption := par;
frmAccessTest.ShowModal;
Result := 456;
end;
As result I have wrong caption of my form. What should I fix to get it working?