1
I have a dll made in C# with a method that receives a string type parameter, I created a function in Delphi that calls this method and passes the following string in the parameter: ’D: Banks Test.fdb', I put a messagebox in the dll just to check how the parameter was coming and the only value that comes is the’D' character the rest of the string does not come. Is there any way to solve it? Below is an excerpt of the code:
dll in C#:
[Guid("36CEE06F-247C-48B4-A8BB-0E591CEF58BE")]
[ComVisible(true)]
public class ReportService
{
[DllExport]
public static bool ListaComprasResumida(string pathBanco, string codEmpresa)
{
MessageBox.Show(pathBanco);
Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
var frm = new FrmListaComprasResumido(pathBanco, codEmpresa);
frm.ShowDialog();
return true;
}
}
Function call on Delphi:
uses
function ListaComprasResumida(pathBanco: string; codEmpresa: string): Boolean; stdcall; external 'Modules.dll';
procedure TRelatorio.btnComprasResumidoClick(Sender: TObject);
var
caminho : string;
codigo : string;
begin
caminho := txtBanco.Text;
codigo := txtCodEmpresa.Text;
ListaComprasResumida(caminho, codigo);
end;
Try sending as Widestring or Ansistring...
– Junior Moreira
Thank you, Ansistring solved my problem. Thank you very much.
– Tobias França