Error with CreateOleObject
Original Reporter info from Mantis: rrricci
-
Reporter name: Renato Ricci
Original Reporter info from Mantis: rrricci
- Reporter name: Renato Ricci
Description:
Hi, I'm trying to use a DLL resource, but having no success..
The DLL accepts 2 " out" parameters. for exemple: PegaNomeCertificado(name, msgresult); Both parameters are 'Out parameters'. Whitch means if I call it, I will get the certificate name on the first parameter.
procedure TForm1.Button1Click(Sender: TObject);
var
UtiL: OleVariant;
i:integer;
nome, msgResultado: widestring;
begin
nome := '';
msgResultado :='';
Util := CreateOleObject('NFe_Util_2G.util');
i:= Util.PegaNomeCertificado(nome, msgResultado);
ShowMessage('Nome: ' + nome);
end;
The line with: CreateOleObject('NFe_Util_2G.util') works fine.. but when calling:
i:= Util.PegaNomeCertificado(nome, msgResultado);
the application returns a '' result in the variable 'nome';
Steps to reproduce:
- Save attachment to the disk;
- Unpack and open the folder. Run Register_DLL_NFe_2G.bat to register the DLL on your "Windows" OS.
- Compile the project and run.. Click the button Button1. It will call the "Open Certificates" from your browser. After selecting the certificate, it was supposed to give its name.. which is not occurring..
Additional information:
I also tried with Lazarus 1.0 fpc 2.6.0, but whe application raise an Access Violation when calling the CreateOleObject('NFe_Util_2G.util');
I tried to use the same code with Delphi, and it is working perfectly.
Mantis conversion info:
- Mantis ID: 23089
- OS: Windows
- OS Build: 7
- Platform: x64
- Version: 2.4.4
- Monitored by: » rrricci (Renato Ricci)