想换种思路,用其它方式读DLL,所以把代码改成:
procedure TFrmMain.Button1Click(Sender: TObject);
var
rc: Variant;
begin
rc:= CreateOLEObject('.\SCardDriverHLJ.SCard');
showmessage(
rc.iReadCardBas(1 , self.le_hospcode.Text)
);
end;
原DLL在执行文件下,且可以看到代码里面内容:
const
// TypeLibrary Major and minor versions
SCardDriverHLJMajorVersion = 3;
SCardDriverHLJMinorVersion = 0;
LIBID_SCardDriverHLJ: TGUID = '{7E1081FE-6CA4-4173-99A0-402D64E8B608}';
DIID_IF_SSCard38: TGUID = '{06A78826-B568-4A68-A355-C64168A9C0A0}';
DIID_IF_HLJBHK: TGUID = '{8B09788F-E52C-44FC-B4DB-AC1B06B41798}';
CLASS_HLJBHK: TGUID = '{6DA7A805-DB3B-4F72-8DA9-9D75D7C7484D}';
DIID_IF_SSCard: TGUID = '{619DBE0F-638F-48C1-999C-E44CBBA80B09}';
CLASS_SCard: TGUID = '{0344F082-98AD-4CAA-925F-EC6B94115CF8}';
CLASS_SCard38: TGUID = '{D9532F10-603B-4BF7-87AE-F4130EF43553}';
type
// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
IF_SSCard38 = dispinterface;
IF_HLJBHK = dispinterface;
IF_SSCard = dispinterface;
// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
HLJBHK = IF_HLJBHK;
SCard = IF_SSCard;
SCard38 = IF_SSCard38;
我需要的函数在SCard中。。。。这么引用有什么问题吗?怎么一点button1就报错:无效的类字符串;