Einzelnen Beitrag anzeigen

Benutzerbild von Deep-Sea
Deep-Sea

Registriert seit: 17. Jan 2007
907 Beiträge
 
Delphi XE2 Professional
 
#20

AW: TSmartCard für Delphi 2010

  Alt 9. Mai 2011, 13:34
Ja was hast du denn geändert?
Bei mir sieht SetActive so aus, wobei die Konstante DllFile vor meiner Änderung DllFile32 oder so ähnlich hieß:
Delphi-Quellcode:
procedure TSmartCard.SetActive(Value: Boolean);
var
  C,L,I: LongInt;
  S: AnsiString;
begin
  if Value = FActive then exit;
  try SetCursor (LoadCursor (0, IDC_WAIT));

  if Value then begin
    if FLibHandle > 0 then FreeLibrary(FLibHandle);
    FLibHandle:=2;
    FLibHandle:=LoadLibrary(DllFile);
    if FLibHandle < HINSTANCE_ERROR then
      Error('Invalid/missing SmartCard library '+ DllFile +
            ' (Error code '+IntToStr(FLibHandle)+')'+#13#10+
            'Pls. download latest version at: http://www.towitoko.de');
    {$IFDEF SCARDDIR}
    FSCardComand:=SCardComand;
    {$ELSE}
    @FSCardComand:=GetProcAddress(FLibHandle, 'SCardComand');
    {$ENDIF}
    if not Assigned(FSCardComand) then begin
      FreeLibrary(FLibHandle);
      FLibHandle:=0;
      Error('Invalid SmartCard library '+StrPas(PAnsiChar(@DllFile[1]))+
            ' (version mismatch)'+#13#10+
            'Pls. download latest version at: http://www.towitoko.de');
    end;
    FTDevHandle:=0;
    L:=-1; C:=0;
    S:=cmSystem+cmAddHWndMsg+
       IntToStr(FWindowHandle)+','+IntToStr(TDEVMSG)+#0;
    I:=FSCardComand(L,@S[1],C,nil,C,nil,C);
    if (I > 0) or (L <= 0) then begin
      FreeLibrary(FLibHandle);
      FLibHandle:=0;
      Error('Cannot access SmartCard Server: '+IntToHex(I,4));
    end;
    FTDevHandle:=L;
    FActive:=True;
    GetDeviceList;
    InsertMenuItems;
  end else begin
    try Comand(cmSystem+cmDelHWnd+IntToStr(FWindowHandle),nil,0,nil,0); except end;
    try Comand(cmSystem+cmDestroy,nil,0,nil,0); except end;
    FreeLibrary(FLibHandle);
    FLibHandle:=0;
    FActive:=False;
  end;
  finally Screen.Cursor:=crDefault; end;
end;
Chris
Die Erfahrung ist ein strenger Schulmeister: Sie prüft uns, bevor sie uns lehrt.
  Mit Zitat antworten Zitat