vc得h文件转换成delphi ( 积分: 50 )

  • 主题发起人 主题发起人 zhaoyong1977
  • 开始时间 开始时间
Z

zhaoyong1977

Unregistered / Unconfirmed
GUEST, unregistred user!
#ifndef CLIENTTRANS_H
#define CLIENTTRANS_H
#define CLIHEADER_API __declspec(dllimport)
#ifdef VBCALL
#define MYSTDCALL _cdecl
#else
#define MYSTDCALL _stdcall
#endif
#define CLIENT_CONNECT 0X101 //Request the remote data
#define CLIENT_DISCONNECT 0X102 //Refuse the remote data
#define SERVER_OK 0x103 //connect ok
#define SERVER_REFUSED 0x104 //refused
#define USER_DATA 0x105 //user message
#define REQUEST_KEYFRAME 0x106 //client request key frame
#define E_RECVDATA 0x201 //recv data exception
#define E_PLAYER 0x202 //player exception
#define E_REFUSED 0x203 //server refuse connect
#define E_SRVCLOSED 0x204 //server is closed
#define E_SENDTHRED 0x205 //send data exception
#define E_RECORD 0x206 //write to file exception
enum DirectXMode{primarySurface,singleOverlay,multipleOverlay};
enum NetMode
{
broadcast=0,
multicast,
udp,
tcp,
dynamic,
rtp,
CustomCtrl
};
enum TKPLAYERTYPE
{
AVE1000_P,
AVE2000_P,
AVE3000_P,
AVE4000_P,
AVE5000_P,
AVE6000_P,
AVE7000_P,
AVE8000_P,
AVE9000_P,
AVENET=100,
AVENONE=200
};
typedef void (_stdcall *GetMPGData)(int idNo,char * data,int length,void * pUsrParam);
typedef void (_stdcall *ClientConnectedCallBack)(unsigned lPlayer, unsigned nChannel);
extern "C"
{
CLIHEADER_API int MYSTDCALL TKLNETCLIENT_CreatePlayer(TKPLAYERTYPE PlayerType, void * pParams);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_ReleasePlayer(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_Connect(
unsigned lPlayer,
char *strIPAddress,
unsigned nPort,
unsigned nChannel,
char *strUserName,
char *strUserPassword,
unsigned dwBufSize);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetConnectedCallBack(unsigned lPlayer, ClientConnectedCallBack ConnectedFunction);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetConnectWait(DWORD dwWaitTime, int nTrynum);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetTTL(unsigned lPlayer, unsigned char cTTLVal);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetVideoWindow(unsigned lPlayer, HWND hWnd, RECT* pRect = NULL);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetDisplayMode(unsigned PlayerId, DirectXMode mode, void *pParams);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_ThrownFrames(unsigned lPlayer, int nFrame);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_RefreshWindow(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetPostFilter(unsigned lPlayer, int nFilter);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_Play(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_Stop(unsigned lPlayer);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_EnableAudio(unsigned lPlayer, BOOL bEnable);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_SetVolume(unsigned lPlayer, unsigned lVolume);
CLIHEADER_API ULONG MYSTDCALL TKLNETCLIENT_GetVolume(unsigned lPlayer);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_EnableDataDriven(unsigned lPlayer, BOOL bEnable);
CLIHEADER_API DWORD MYSTDCALL TKLNETCLIENT_GetSdkVersion();
CLIHEADER_API int MYSTDCALL TKLNETCLIENT_GetPlayerStatus(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetErrorNotify(
unsigned lPlayer,
HWND hWnd,
unsigned nErrorMsgID,
HANDLE hEndEvent);
CLIHEADER_API int MYSTDCALL TKLNETCLIENT_GetLastError(unsigned lPlayer);
CLIHEADER_API char* MYSTDCALL TKLNETCLIENT_GetErrorString(int nErrno);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_Reset(unsigned lPlayer);
CLIHEADER_API DWORD MYSTDCALL TKLNETCLIENT_GetBMPSize(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_CaptureBitmap(unsigned lPlayer, char *strFilename, BYTE *pBitmap );
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_StartRecord(unsigned lPlayer, char *strFilename);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_StopRecord(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetDataArriveNotify(
unsigned lPlayer,
HWND hWnd,
unsigned nEndMsgID,
HANDLE hEndEvent);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_GetHeader(unsigned lPlayer, void *pheadBuffer, int &nheadLength);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_GetData(
unsigned lPlayer,
void *pDataBuffer,
int &nDataLength,
DWORD &nNumber,
int &nFrameType);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_MessageToServer(unsigned lPlayer, void *pDataBuffer, int nDataLength);
CLIHEADER_API int MYSTDCALL TKLNETCLIENT_SetMessageNotify(unsigned lPlayer, HWND hWnd, unsigned nMsgID, HANDLE hEndEvent);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_GetServerMessage(unsigned lPlayer, void *pDataBuffer, int &nDataLength);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_GetServerInfo(unsigned lPlayer, int &Channel, int &StreamID, char *param);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_GetPlayingInfo(unsigned lPlayer, int&
CurrentFrame, int&
WaitingFrames);
}
#endif
将以上得vc转换成delphi
 
#ifndef CLIENTTRANS_H
#define CLIENTTRANS_H
#define CLIHEADER_API __declspec(dllimport)
#ifdef VBCALL
#define MYSTDCALL _cdecl
#else
#define MYSTDCALL _stdcall
#endif
#define CLIENT_CONNECT 0X101 //Request the remote data
#define CLIENT_DISCONNECT 0X102 //Refuse the remote data
#define SERVER_OK 0x103 //connect ok
#define SERVER_REFUSED 0x104 //refused
#define USER_DATA 0x105 //user message
#define REQUEST_KEYFRAME 0x106 //client request key frame
#define E_RECVDATA 0x201 //recv data exception
#define E_PLAYER 0x202 //player exception
#define E_REFUSED 0x203 //server refuse connect
#define E_SRVCLOSED 0x204 //server is closed
#define E_SENDTHRED 0x205 //send data exception
#define E_RECORD 0x206 //write to file exception
enum DirectXMode{primarySurface,singleOverlay,multipleOverlay};
enum NetMode
{
broadcast=0,
multicast,
udp,
tcp,
dynamic,
rtp,
CustomCtrl
};
enum TKPLAYERTYPE
{
AVE1000_P,
AVE2000_P,
AVE3000_P,
AVE4000_P,
AVE5000_P,
AVE6000_P,
AVE7000_P,
AVE8000_P,
AVE9000_P,
AVENET=100,
AVENONE=200
};
typedef void (_stdcall *GetMPGData)(int idNo,char * data,int length,void * pUsrParam);
typedef void (_stdcall *ClientConnectedCallBack)(unsigned lPlayer, unsigned nChannel);
extern "C"
{
CLIHEADER_API int MYSTDCALL TKLNETCLIENT_CreatePlayer(TKPLAYERTYPE PlayerType, void * pParams);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_ReleasePlayer(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_Connect(
unsigned lPlayer,
char *strIPAddress,
unsigned nPort,
unsigned nChannel,
char *strUserName,
char *strUserPassword,
unsigned dwBufSize);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetConnectedCallBack(unsigned lPlayer, ClientConnectedCallBack ConnectedFunction);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetConnectWait(DWORD dwWaitTime, int nTrynum);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetTTL(unsigned lPlayer, unsigned char cTTLVal);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetVideoWindow(unsigned lPlayer, HWND hWnd, RECT* pRect = NULL);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetDisplayMode(unsigned PlayerId, DirectXMode mode, void *pParams);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_ThrownFrames(unsigned lPlayer, int nFrame);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_RefreshWindow(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetPostFilter(unsigned lPlayer, int nFilter);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_Play(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_Stop(unsigned lPlayer);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_EnableAudio(unsigned lPlayer, BOOL bEnable);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_SetVolume(unsigned lPlayer, unsigned lVolume);
CLIHEADER_API ULONG MYSTDCALL TKLNETCLIENT_GetVolume(unsigned lPlayer);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_EnableDataDriven(unsigned lPlayer, BOOL bEnable);
CLIHEADER_API DWORD MYSTDCALL TKLNETCLIENT_GetSdkVersion();
CLIHEADER_API int MYSTDCALL TKLNETCLIENT_GetPlayerStatus(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetErrorNotify(
unsigned lPlayer,
HWND hWnd,
unsigned nErrorMsgID,
HANDLE hEndEvent);
CLIHEADER_API int MYSTDCALL TKLNETCLIENT_GetLastError(unsigned lPlayer);
CLIHEADER_API char* MYSTDCALL TKLNETCLIENT_GetErrorString(int nErrno);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_Reset(unsigned lPlayer);
CLIHEADER_API DWORD MYSTDCALL TKLNETCLIENT_GetBMPSize(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_CaptureBitmap(unsigned lPlayer, char *strFilename, BYTE *pBitmap );
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_StartRecord(unsigned lPlayer, char *strFilename);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_StopRecord(unsigned lPlayer);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetDataArriveNotify(
unsigned lPlayer,
HWND hWnd,
unsigned nEndMsgID,
HANDLE hEndEvent);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_GetHeader(unsigned lPlayer, void *pheadBuffer, int &nheadLength);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_GetData(
unsigned lPlayer,
void *pDataBuffer,
int &nDataLength,
DWORD &nNumber,
int &nFrameType);
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_MessageToServer(unsigned lPlayer, void *pDataBuffer, int nDataLength);
CLIHEADER_API int MYSTDCALL TKLNETCLIENT_SetMessageNotify(unsigned lPlayer, HWND hWnd, unsigned nMsgID, HANDLE hEndEvent);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_GetServerMessage(unsigned lPlayer, void *pDataBuffer, int &nDataLength);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_GetServerInfo(unsigned lPlayer, int &Channel, int &StreamID, char *param);
CLIHEADER_API void MYSTDCALL TKLNETCLIENT_GetPlayingInfo(unsigned lPlayer, int&
CurrentFrame, int&
WaitingFrames);
}
#endif
将以上得vc转换成delphi
 
typedef void (_stdcall *GetMPGData)(int idNo,char * data,int length,void * pUsrParam);
typedef void (_stdcall *ClientConnectedCallBack)(unsigned lPlayer, unsigned nChannel);
只要把它转换成delphi得怎么转?谢谢
 
大概这样子:
type
GetMPGData = procedure(idNo: integer;
data: pchar;
length: integer;
pUsrParam: Pointer) of object;stdcall;
ClientConnectedCallBack = procedure(lPlayer: cardinal;
nChannel: cardinal) of object;stdcall;
就是void * pUsrParam这个不太清楚了,随便用个指针看看行不
 
楼上的,不能用of object,原C函数也不是成员函数啊
否则第一个参数事实上是SELF指针
type
GetMPGData = procedure(idNo: integer;
data: pchar;
length: integer;
pUsrParam: Pointer);stdcall;
ClientConnectedCallBack = procedure(lPlayer: cardinal;
nChannel: cardinal);stdcall;
void*便用Pointer即可,都是无类型指针
 
CLIHEADER_API BOOL MYSTDCALL TKLNETCLIENT_SetConnectedCallBack(unsigned lPlayer, ClientConnectedCallBack ConnectedFunction);
这个怎么定义呢?帮帮我吧?分可以加得
 
轻松虎 (2004-03-29 19:15:46)
有一个很好的代码自动转换辅助工具headConv.这是著名的荷兰程序员Bob的杰作.最初的版本(1.0,2.0)是要收费的(25美金),我们得到了其最新的一个免费版本3.25命令行版,你可以从一个delphi控件收集站点(delphi根据地 http://warez.zb169.net/)去下载它.其用法也非常简单,一共有三个可选项:
  -o 覆盖原有单元
  -x 强制产生动态声明单元;
  -m 强制产生静态声明单元;
这样就可以大大减少手工翻译的时间,而将主要精力用于润色和优化。
http://www.delphibbs.com/delphibbs/dispq.asp?lid=700803
 
to app2001:
网页打不开,还有别的地址吗?
 
http://vcl.vclxx.org/DELPHI/D32FREE/HEADCONV.ZIP
将 C/C++ 的 DLL 宣告档转换成 Object Pascal 的工具 ( 4.20 版 ),作者 : Dr. Bob。
 
好了,散分了
 
后退
顶部