Boa tarde Pessoal, sou novo em Delphi, uso mais para estudos estou com o Seguinte erro, quando aperto para cancelar a operação, estou utilizando o CAPICOM_TLB, segue minha linha de codigo:
unit teste;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ACBrBase, ACBrDFe, Vcl.StdCtrls, CAPICOM_TLB;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var
i : integer;
Store : IStore3;
Cert : ICertificate2;
Certs : ICertificates2;
begin
Store := CoStore.Create;
Store.Open(CAPICOM_CURRENT_USER_STORE, 'MY', CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED);
Certs := Store.Certificates as ICertificates2;
Certs.Select ('Selecione um Certificado','Selecione o Certificado que deseja utilizar:', false);
Cert := IInterface(Certs.Item[1]) as ICertificate2;
try
Edit1.Text := Cert.SerialNumber;
Except
on E: Exception do
if E.Message = 'The requested operation has been cancelled by the user' then exit;
// If Not (Certs.Count = 0) then Begin
// Cert := IInterface(Certs.Item[1]) as ICertificate2;
// Edit1.Text := Cert.SerialNumber;
// End;
end;
end;
end.