文件如下:
#include "stdafx.h"#define CPLAYER_APIIMPORT  extern "C"__declspec(dllimport)  //这个怎么翻译?
#define CHANNEL_NUM 17
#define ... ...
... ...
... ...
//以下函数在delphi里应怎么搞??
CPLAYER_APIIMPORT LONG  __stdcall VS_MP4_ClientStart(PSOCKET_CLIENTINFO m_pClientinfo,void(WINAPI *ReadDataCallBack)(DWORD StockHandle,UCHAR *pPacketBuffer,DWORD nPacketSize),WORD dserverport = 8000);
CPLAYER_APIIMPORT BOOL  __stdcall VS_MP4_ClientStop(LONG StockHandle);
CPLAYER_APIIMPORT BOOL __stdcall VS_MP4_ClientStartCapture(LONG StockHandle);
CPLAYER_APIIMPORT BOOL __stdcall VS_MP4_ClientStartCaptureFile(LONG StockHandle,LPTSTR m_FileName);
CPLAYER_APIIMPORT BOOL __stdcall VS_MP4_ClientStopCapture(LONG StockHandle);
CPLAYER_APIIMPORT LONG  __stdcall VS_MP4_ClientGetState(LONG StockHandle);
CPLAYER_APIIMPORT BOOL __stdcall VS_MP4_ClientPlayAudio(LONG StockHandle);
... ...
... ...

解决方案 »

  1.   

    jedi网站上有一个C头文件转Delphi的程序,去看一下。
      

  2.   

    www.drbob.com上有个
    headconv4.2
      

  3.   

    看楼主辛苦,帮你转一下:)unit dllimport;//extern "C" __declspec(dllimport) LONG __stdcall VS_MP4_ClientStart(void *,void (WINAPI *)(DWORD,UCHAR *,DWORD),WORD);
    //extern "C" __declspec(dllimport) BOOL __stdcall VS_MP4_ClientStop(LONG);
    //extern "C" __declspec(dllimport) BOOL __stdcall VS_MP4_ClientStartCapture(LONG);
    //extern "C" __declspec(dllimport) BOOL __stdcall VS_MP4_ClientStartCaptureFile(LONG,LPTSTR);
    //extern "C" __declspec(dllimport) BOOL __stdcall VS_MP4_ClientStopCapture(LONG);
    //extern "C" __declspec(dllimport) LONG __stdcall VS_MP4_ClientGetState(LONG);
    //extern "C" __declspec(dllimport) BOOL __stdcall VS_MP4_ClientPlayAudio(LONG);interface//typedef void (WINAPI *TCallBack)(DWORD,UCHAR *,DWORD);
    type TCallBack = procedure (dw1: cardinal; pb: pbyte; dw2: cardinal); stdcall;function VS_MP4_ClientStart(p: pointer; pf: TCallBack; w: word): integer; stdcall;
    function VS_MP4_ClientStop(i: integer): integer; stdcall;
    function VS_MP4_ClientStartCapture(i: integer): integer; stdcall;
    function VS_MP4_ClientStartCaptureFile(i: integer; sz: pchar): integer; stdcall;
    function VS_MP4_ClientStopCapture(i: integer): integer; stdcall;
    function VS_MP4_ClientGetState(i: integer): integer; stdcall;
    function VS_MP4_ClientPlayAudio(i: integer): integer; stdcall;implementationconst
      MYDLL = 'testdll.dll'; //改成你的dll文件名function VS_MP4_ClientStart(p: pointer; pf: TCallBack; w: word): integer; external MYDLL name '_VS_MP4_ClientStart@12';
    function VS_MP4_ClientStop(i: integer): integer; external MYDLL name '_VS_MP4_ClientStop@4';
    function VS_MP4_ClientStartCapture(i: integer): integer; external MYDLL name '_VS_MP4_ClientStartCapture@4';
    function VS_MP4_ClientStartCaptureFile(i: integer; sz: pchar): integer; external MYDLL name '_VS_MP4_ClientStartCaptureFile@8';
    function VS_MP4_ClientStopCapture(i: integer): integer; external MYDLL name '_VS_MP4_ClientStopCapture@4';
    function VS_MP4_ClientGetState(i: integer): integer; external MYDLL name '_VS_MP4_ClientGetState@4';
    function VS_MP4_ClientPlayAudio(i: integer): integer; external MYDLL name '_VS_MP4_ClientPlayAudio@4';end.
      

  4.   

    如果dll是unicode版本的,请将
    function VS_MP4_ClientStartCaptureFile(i: integer; sz: pchar): integer; stdcall;
    function VS_MP4_ClientStartCaptureFile(i: integer; sz: pchar): integer; external MYDLL name '_VS_MP4_ClientStartCaptureFile@8';
    改为
    function VS_MP4_ClientStartCaptureFile(i: integer; sz: pwidechar): integer; stdcall;
    function VS_MP4_ClientStartCaptureFile(i: integer; sz: pwidechar): integer; external MYDLL name '_VS_MP4_ClientStartCaptureFile@8';