X
xhd730
Unregistered / Unconfirmed
GUEST, unregistred user!
这时我的C头文件
ifndef _ATMEL_IC_READER_HPP
#define _ATMEL_IC_READER_HPP
#define RF3_LANGID_CHINESE 0
#define RF3_LANGID_ENGLISH 1
#include <windef.h>
BOOL APIENTRY rf3OpenComm(BYTE CommID, LPHANDLE hComm);
BOOL APIENTRY rf3CloseComm(HANDLE hComm);
BSTR APIENTRY rf3GetErrText(int nErrCode, BYTE nLangID);
void APIENTRY rf3GetErrText2(int nErrCode, BYTE nLangID, LPSTR lpMsg);
int APIENTRY rf3SetCardType(HANDLE hComm, BYTE nType);
int APIENTRY rf3DisableCard(HANDLE hComm);
void APIENTRY rf3GetCardParam(LPSTR lpValue, BYTE AOR, BYTE MAXBLK, BYTE usePWD);
int APIENTRY rf3ReadIC(HANDLE hComm, LPSAFEARRAY *ppsaData, LPBYTE lpbCount, LPBYTE lpbType);
int APIENTRY rf3ReadIC_P(HANDLE hComm, LPSTR lpPwd, LPSAFEARRAY *ppsaData, LPBYTE lpbCount, LPBYTE lpbType);
int APIENTRY rf3WriteIC(HANDLE hComm, BYTE nBlock, BYTE nFix, LPSTR lpData);
int APIENTRY rf3WriteIC_P(HANDLE hComm, LPSTR lpPwd, BYTE nBlock, BYTE nFix, LPSTR lpData);
#endif
//*** End of File
unit RF3READ;
{**************************************************************************}
{ }
{ This C DLL header file first (automatic) conversion generated by: }
{ HeadConv 4.0 (c) 2000 by Bob Swart (aka Dr.Bob - www.drbob42.com) }
{ Final Delphi-Jedi (Darth) command-line units edition }
{ }
{ Generated Date: 2003-6-3 }
{ Generated Time: 9:09:28 }
{ }
{**************************************************************************}
interface
uses
{$IFDEF WIN32}
Windows;
{$else
}
Wintypes, WinProcs;
{$ENDIF}
我用HEADCONV转成的delphi .pas 文件
{=> g:/工具/转换工具/headconv/RF3READ.H <=}
{$IFNDEF _ATMEL_IC_READER_HPP}
{$DEFINE _ATMEL_IC_READER_HPP}
const
RF3_LANGID_CHINESE = 0;
const
RF3_LANGID_ENGLISH = 1;
//{$INCLUDE <windef.h>}
var
rf3OpenComm: function(CommID: BYTE;
var hComm: Handle): Bool {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3CloseComm: function(hComm: THandle): Bool {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3GetErrText: function(nErrCode: Integer;
nLangID: BYTE): BSTR {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3GetErrText2: procedure(nErrCode: Integer;
nLangID: BYTE;
lpMsg: PChar) {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3SetCardType: function(hComm: THandle;
nType: BYTE): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3DisableCard: function(hComm: THandle): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3GetCardParam: procedure(lpValue: PChar;
AOR: BYTE;
MAXBLK: BYTE;
usePWD: BYTE) {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3ReadIC: function(hComm: THandle;
var ppsaData: LPSAFEARRAY;
var lpbCount: BYTE;
var lpbType: BYTE): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3ReadIC_P: function(hComm: THandle;
lpPwd: PChar;
var ppsaData: LPSAFEARRAY;
var lpbCount: BYTE;
var lpbType: BYTE): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3WriteIC: function(hComm: THandle;
nBlock: BYTE;
nFix: BYTE;
lpData: PChar): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3WriteIC_P: function(hComm: THandle;
lpPwd: PChar;
nBlock: BYTE;
nFix: BYTE;
lpData: PChar): Integer {$IFDEF WIN32} stdcall {$ENDIF};
{$ENDIF}
{///*** End of File************ }
var
DLLLoaded: Boolean { is DLL (dynamically) loaded already? }
{$IFDEF WIN32} = False;
{$ENDIF}
implementation
var
SaveExit: pointer;
DLLHandle: THandle;
{$IFNDEF MSDOS}
ErrorMode: Integer;
{$ENDIF}
procedure NewExit;
far;
begin
ExitProc := SaveExit;
FreeLibrary(DLLHandle)
end {NewExit};
procedure LoadDLL;
begin
if DLLLoaded then
Exit;
{$IFNDEF MSDOS}
ErrorMode := SetErrorMode($8000{SEM_NoOpenFileErrorBox});
{$ENDIF}
DLLHandle := LoadLibrary('RF3READ.DLL');
if DLLHandle >= 32 then
begin
DLLLoaded := True;
SaveExit := ExitProc;
ExitProc := @NewExit;
@rf3OpenComm := GetProcAddress(DLLHandle,'rf3OpenComm');
{$IFDEF WIN32}
Assert(@rf3OpenComm <> nil);
{$ENDIF}
@rf3CloseComm := GetProcAddress(DLLHandle,'rf3CloseComm');
{$IFDEF WIN32}
Assert(@rf3CloseComm <> nil);
{$ENDIF}
@rf3GetErrText := GetProcAddress(DLLHandle,'rf3GetErrText');
{$IFDEF WIN32}
Assert(@rf3GetErrText <> nil);
{$ENDIF}
@rf3GetErrText2 := GetProcAddress(DLLHandle,'rf3GetErrText2');
{$IFDEF WIN32}
Assert(@rf3GetErrText2 <> nil);
{$ENDIF}
@rf3SetCardType := GetProcAddress(DLLHandle,'rf3SetCardType');
{$IFDEF WIN32}
Assert(@rf3SetCardType <> nil);
{$ENDIF}
@rf3DisableCard := GetProcAddress(DLLHandle,'rf3DisableCard');
{$IFDEF WIN32}
Assert(@rf3DisableCard <> nil);
{$ENDIF}
@rf3GetCardParam := GetProcAddress(DLLHandle,'rf3GetCardParam');
{$IFDEF WIN32}
Assert(@rf3GetCardParam <> nil);
{$ENDIF}
@rf3ReadIC := GetProcAddress(DLLHandle,'rf3ReadIC');
{$IFDEF WIN32}
Assert(@rf3ReadIC <> nil);
{$ENDIF}
@rf3ReadIC_P := GetProcAddress(DLLHandle,'rf3ReadIC_P');
{$IFDEF WIN32}
Assert(@rf3ReadIC_P <> nil);
{$ENDIF}
@rf3WriteIC := GetProcAddress(DLLHandle,'rf3WriteIC');
{$IFDEF WIN32}
Assert(@rf3WriteIC <> nil);
{$ENDIF}
@rf3WriteIC_P := GetProcAddress(DLLHandle,'rf3WriteIC_P');
{$IFDEF WIN32}
Assert(@rf3WriteIC_P <> nil);
{$ENDIF}
end
else
begin
DLLLoaded := False;
{ Error: RF3READ.DLL could not be loaded !! }
end;
{$IFNDEF MSDOS}
SetErrorMode(ErrorMode)
{$ENDIF}
end {LoadDLL};
begin
LoadDLL;
end.
但是c 中的LPHANDLE ,Bstr,LPSAFEARRAY 这几个类型不知道怎么样进行翻译。
各位提出点意见
ifndef _ATMEL_IC_READER_HPP
#define _ATMEL_IC_READER_HPP
#define RF3_LANGID_CHINESE 0
#define RF3_LANGID_ENGLISH 1
#include <windef.h>
BOOL APIENTRY rf3OpenComm(BYTE CommID, LPHANDLE hComm);
BOOL APIENTRY rf3CloseComm(HANDLE hComm);
BSTR APIENTRY rf3GetErrText(int nErrCode, BYTE nLangID);
void APIENTRY rf3GetErrText2(int nErrCode, BYTE nLangID, LPSTR lpMsg);
int APIENTRY rf3SetCardType(HANDLE hComm, BYTE nType);
int APIENTRY rf3DisableCard(HANDLE hComm);
void APIENTRY rf3GetCardParam(LPSTR lpValue, BYTE AOR, BYTE MAXBLK, BYTE usePWD);
int APIENTRY rf3ReadIC(HANDLE hComm, LPSAFEARRAY *ppsaData, LPBYTE lpbCount, LPBYTE lpbType);
int APIENTRY rf3ReadIC_P(HANDLE hComm, LPSTR lpPwd, LPSAFEARRAY *ppsaData, LPBYTE lpbCount, LPBYTE lpbType);
int APIENTRY rf3WriteIC(HANDLE hComm, BYTE nBlock, BYTE nFix, LPSTR lpData);
int APIENTRY rf3WriteIC_P(HANDLE hComm, LPSTR lpPwd, BYTE nBlock, BYTE nFix, LPSTR lpData);
#endif
//*** End of File
unit RF3READ;
{**************************************************************************}
{ }
{ This C DLL header file first (automatic) conversion generated by: }
{ HeadConv 4.0 (c) 2000 by Bob Swart (aka Dr.Bob - www.drbob42.com) }
{ Final Delphi-Jedi (Darth) command-line units edition }
{ }
{ Generated Date: 2003-6-3 }
{ Generated Time: 9:09:28 }
{ }
{**************************************************************************}
interface
uses
{$IFDEF WIN32}
Windows;
{$else
}
Wintypes, WinProcs;
{$ENDIF}
我用HEADCONV转成的delphi .pas 文件
{=> g:/工具/转换工具/headconv/RF3READ.H <=}
{$IFNDEF _ATMEL_IC_READER_HPP}
{$DEFINE _ATMEL_IC_READER_HPP}
const
RF3_LANGID_CHINESE = 0;
const
RF3_LANGID_ENGLISH = 1;
//{$INCLUDE <windef.h>}
var
rf3OpenComm: function(CommID: BYTE;
var hComm: Handle): Bool {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3CloseComm: function(hComm: THandle): Bool {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3GetErrText: function(nErrCode: Integer;
nLangID: BYTE): BSTR {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3GetErrText2: procedure(nErrCode: Integer;
nLangID: BYTE;
lpMsg: PChar) {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3SetCardType: function(hComm: THandle;
nType: BYTE): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3DisableCard: function(hComm: THandle): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3GetCardParam: procedure(lpValue: PChar;
AOR: BYTE;
MAXBLK: BYTE;
usePWD: BYTE) {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3ReadIC: function(hComm: THandle;
var ppsaData: LPSAFEARRAY;
var lpbCount: BYTE;
var lpbType: BYTE): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3ReadIC_P: function(hComm: THandle;
lpPwd: PChar;
var ppsaData: LPSAFEARRAY;
var lpbCount: BYTE;
var lpbType: BYTE): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3WriteIC: function(hComm: THandle;
nBlock: BYTE;
nFix: BYTE;
lpData: PChar): Integer {$IFDEF WIN32} stdcall {$ENDIF};
var
rf3WriteIC_P: function(hComm: THandle;
lpPwd: PChar;
nBlock: BYTE;
nFix: BYTE;
lpData: PChar): Integer {$IFDEF WIN32} stdcall {$ENDIF};
{$ENDIF}
{///*** End of File************ }
var
DLLLoaded: Boolean { is DLL (dynamically) loaded already? }
{$IFDEF WIN32} = False;
{$ENDIF}
implementation
var
SaveExit: pointer;
DLLHandle: THandle;
{$IFNDEF MSDOS}
ErrorMode: Integer;
{$ENDIF}
procedure NewExit;
far;
begin
ExitProc := SaveExit;
FreeLibrary(DLLHandle)
end {NewExit};
procedure LoadDLL;
begin
if DLLLoaded then
Exit;
{$IFNDEF MSDOS}
ErrorMode := SetErrorMode($8000{SEM_NoOpenFileErrorBox});
{$ENDIF}
DLLHandle := LoadLibrary('RF3READ.DLL');
if DLLHandle >= 32 then
begin
DLLLoaded := True;
SaveExit := ExitProc;
ExitProc := @NewExit;
@rf3OpenComm := GetProcAddress(DLLHandle,'rf3OpenComm');
{$IFDEF WIN32}
Assert(@rf3OpenComm <> nil);
{$ENDIF}
@rf3CloseComm := GetProcAddress(DLLHandle,'rf3CloseComm');
{$IFDEF WIN32}
Assert(@rf3CloseComm <> nil);
{$ENDIF}
@rf3GetErrText := GetProcAddress(DLLHandle,'rf3GetErrText');
{$IFDEF WIN32}
Assert(@rf3GetErrText <> nil);
{$ENDIF}
@rf3GetErrText2 := GetProcAddress(DLLHandle,'rf3GetErrText2');
{$IFDEF WIN32}
Assert(@rf3GetErrText2 <> nil);
{$ENDIF}
@rf3SetCardType := GetProcAddress(DLLHandle,'rf3SetCardType');
{$IFDEF WIN32}
Assert(@rf3SetCardType <> nil);
{$ENDIF}
@rf3DisableCard := GetProcAddress(DLLHandle,'rf3DisableCard');
{$IFDEF WIN32}
Assert(@rf3DisableCard <> nil);
{$ENDIF}
@rf3GetCardParam := GetProcAddress(DLLHandle,'rf3GetCardParam');
{$IFDEF WIN32}
Assert(@rf3GetCardParam <> nil);
{$ENDIF}
@rf3ReadIC := GetProcAddress(DLLHandle,'rf3ReadIC');
{$IFDEF WIN32}
Assert(@rf3ReadIC <> nil);
{$ENDIF}
@rf3ReadIC_P := GetProcAddress(DLLHandle,'rf3ReadIC_P');
{$IFDEF WIN32}
Assert(@rf3ReadIC_P <> nil);
{$ENDIF}
@rf3WriteIC := GetProcAddress(DLLHandle,'rf3WriteIC');
{$IFDEF WIN32}
Assert(@rf3WriteIC <> nil);
{$ENDIF}
@rf3WriteIC_P := GetProcAddress(DLLHandle,'rf3WriteIC_P');
{$IFDEF WIN32}
Assert(@rf3WriteIC_P <> nil);
{$ENDIF}
end
else
begin
DLLLoaded := False;
{ Error: RF3READ.DLL could not be loaded !! }
end;
{$IFNDEF MSDOS}
SetErrorMode(ErrorMode)
{$ENDIF}
end {LoadDLL};
begin
LoadDLL;
end.
但是c 中的LPHANDLE ,Bstr,LPSAFEARRAY 这几个类型不知道怎么样进行翻译。
各位提出点意见