1、typedef void (*FILE_REF_DONE_CALLBACK)(UINT nChannel,UINT nSize);
2、DLLEXPORT_API int __stdcall HW_GetChannelNum(long nDspNum,long *pChannelNum,ULONG nNumsToGet,ULONG * pNumsGotten);
3、typedef struct
{
BOARD_TYPE_DS type; //板卡类型
BYTE sn[16]; //序列号
UINT dspCount; //板卡包含的DSP个数
UINT firstDspIndex; //板卡上第一个DSP的索引
UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DS_BOARD_DETAIL;
4、#define DRAWFUN(x) void  (CALLBACK* x)(long nPort,HDC hDc,LONG nUser)以上都是我不太懂怎么翻译的,大家帮帮忙

解决方案 »

  1.   

    1.
    2.function HW_GetChannelNum(nDspNum: LONG,void pChannelNum: LONG, nNumsToGet: ULONG,void pNumsGotten:ULONG);integer; stdcall; external 'xxx.dll' name 'GetChannelNum'
      

  2.   

    3.
    TDS_BOARD_DETAIL = record
      type:BOARD_TYPE_D6;
      sn: array[0..15] of byte;
      dspCount: UINT;
      ...
    end;
      

  3.   

    Elysium(Elysium) 我不太懂哦,直接用原型是什么意思?还有,第2个c++是传个指针过去,这样就可以改变那个变量的值,delphi 不用声明吗?
      

  4.   

    第二个是delphi对于dll函数的声明,1和4类似于返回一个函数的指针,在delphi中类似这样的写法:
    var functionA: functionname(nChannel:UINT; nSize:UINT);stdcall;可以使用LoadLibrary和GetProcAddress打开dll文件,调用dll函数:implementationvar
      Lib:       THandle = 0;
      VersionInfo:  TOsVersionInfo;
      PlatformVersion: DWORD;
      hWndParent:   HWND;  ErrorString:  PChar;
    procedure LoadDLL;
    begin
      if (Lib = 0) then
      begin
        Lib := LoadLibrary(XXXDLL);
        //if (Lib = 0) then
        //  Raise Exception.Create('XXXAPI32 loaded failed');
        if (Lib <> 0) then
        begin
          VersionInfo.dwOSVersionInfoSize := SizeOf(VersionInfo);
          if GetVersionEx(VersionInfo) then
            PlatformVersion := VersionInfo.dwPlatformId
          else
            PlatformVersion := VER_PLATFORM_WIN32s;      functionA := GetProcAddress(Lib, 'functionname');
    ...
      

  5.   

    3个里面 type是delphi的关键字 这个怎么处理啊?
      

  6.   

    1、typedef void (*FILE_REF_DONE_CALLBACK)(UINT nChannel,UINT nSize);
      这是定义一个函数指针类型的数据类型;
         type 
           FILE_REF_DONE_CALLBACK=procedure (nChannel,nSize:dword);
           
    2、DLLEXPORT_API int __stdcall HW_GetChannelNum(long nDspNum,long *pChannelNum,ULONG nNumsToGet,ULONG * pNumsGotten);
      这是定义一个接口函数:
         function HW_GetChannelNum(nDspNum:int64;var pChannelNum:int64;nNumsToGet:Cardinal;pNumsGotten:Cardinal):integer;stdcall;3、typedef struct
    {
    BOARD_TYPE_DS type;//板卡类型
    BYTE sn[16];//序列号
    UINT dspCount;//板卡包含的DSP个数
    UINT firstDspIndex;//板卡上第一个DSP的索引
    UINT encodeChannelCount;//板卡包含的编码通道个数
    UINT firstEncodeChannelIndex;//板卡上第一个编码通道的索引
    UINT decodeChannelCount;//板卡包含的解码通道个数
    UINT firstDecodeChannelIndex;//板卡上第一个解码通道的索引
    UINT displayChannelCount;//板卡包含的视频输出通道个数
    UINT firstDisplayChannelIndex;//板卡上第一个视频输出通道的索引
    UINT reserved1;
    UINT reserved2;
    UINT reserved3;
    UINT reserved4;
    }DS_BOARD_DETAIL;这个相当于在DELPHI中定义一个记录类型:
    type 
      DS_BOARD_DETAIL=record
    type:integer;//(BOARD_TYPE_DS这个类型是自定义类型,估计为integer类型);//板卡类型
    sn:array [0..15] of byte;//序列号
    dspCount:dword;//板卡包含的DSP个数
    firstDspIndex:dword;//板卡上第一个DSP的索引
    encodeChannelCount:dword;//板卡包含的编码通道个数
    firstEncodeChannelIndex:dword;//板卡上第一个编码通道的索引
    decodeChannelCount:dword;//板卡包含的解码通道个数
    firstDecodeChannelIndex:dword;//板卡上第一个解码通道的索引
    displayChannelCount:dword;//板卡包含的视频输出通道个数
    firstDisplayChannelIndex:dword;//板卡上第一个视频输出通道的索引
    reserved1:dword;
    reserved2:dword;
    reserved3:dword;
    reserved4:dword;  end;
    4、#define DRAWFUN(x)  void (CALLBACK * x)(long nPort,HDC hDc,LONG nUser)这是定义一个宏,在宏里面调用一个回调函数。回调函数结构如下:
      MY_CALLBACK=procedure (nPort:integer;hDc:HDC;nUser:Integer);
      P_MY_CALLBACK=^MY_CALLBACK;在DELPHI中你可以通过定义一个全局的方法来实现这个宏定义:
    procedure DRAWFUN(X:P_MY_CALLBACK{回调入口地址};nPort:integer;hDc:HDC;nUser:Integer{回调函数用的参数表});
    begin
      MY_CALLBACK(x)(nPort,hDc,nUser);
    end;PS:楼主是要做视频接口程序?最后的回调似是要取得某个设备的句柄啊;如果是要取得句柄,你把过程改成函数就行了。返回类型可以是HANDLE类型的数据;
      

  7.   

    dinglinger(红辣椒) ,这里,  DS_BOARD_DETAIL=record
    type:integer;//(BOARD_TYPE_DS这个类型是自定义类型,估计为integer类型);//板卡类型
    ...
    end;那个type是关键字啊,怎么弄呢?
      

  8.   

    你换个名字不就行了吗?
    域名称只是个标记。不影响数据结构的。
    可以这样:
      _type:integer;//---
    或是换成这样的:
      BOARD_TYPE:integer;