gpt4 book ai didi

将 C 头文件转换为 delphi

转载 作者:行者123 更新时间:2023-12-03 15:50:33 28 4
gpt4 key购买 nike

int  WINAPI  BiMICRSetReadBackFunction(
int nHandle,
int (CALLBACK *pMicrCB)(void),
LPBYTE pReadBuffSize,
LPBYTE readCharBuff,
LPBYTE pStatus,
LPBYTE pDetail);

typedef int (CALLBACK* MICRCallback)(void);
typedef int (CALLBACK* StatusCallback)(DWORD);

int WINAPI BiSetInkStatusBackFunction(int nHandle,
int (CALLBACK *pStatusCB)(DWORD dwStatus)
);

我需要将此函数转换为 Delphi。

我尝试使用headconv4.2,但生成的静态单元未完成,并且编译时出现错误。

预先感谢您的帮助:D

最佳答案

假设WINAPICALLBACK始终为__stdcallDWORDunsigned intLPBYTE 作为 unsigned char *,您可以尝试我所做的这个脏转换:

unit UHeader;

interface

// Data types

type
PByte = ^Byte;
PPByte = ^PByte;

// Prototypes

type
TMICRCallback = function: Integer; stdcall;
TStatusCallback = function(dwParam: Cardinal): Integer; stdcall;

// Functions

type
TBiMICRSetReadBackFunction =
function(nHande: Integer;
pMicrCB: TMICRCallback;
pReadBuffSize: PByte;
readCharBuff: PByte;
pStatus: PByte;
pDetail: PByte
): Integer; stdcall;

var
BiMICRSetReadBackFunction: TBiMICRSetReadBackFunction;

type
TBiSetInkStatusBackFunction =
function(nHandle: Integer;
pStatusCB: TStatusCallback
): Integer; stdcall;

var
BiSetInkStatusBackFunction: TBiSetInkStatusBackFunction;

implementation

end.

不过,我并不完全确定这是否正确......但这可能是您尝试自己转换它的途径。

关于将 C 头文件转换为 delphi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12592697/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com