常
常广荣
Unregistered / Unconfirmed
GUEST, unregistred user!
请教delphi调用带指针的结构体问题vc版本//打开前端通道typedef struct tagDVSNET_CHANNEL_INFO { unsigned long lStructSize; //结构大小,设置为sizeof(DVSNET_CHANNEL_INFO) unsigned long dwStreamNo; //码流号(用于双码流) unsigned long nProtocol; //网络协议//数据发送协议#define PROTOCOL_TCP 0 //TCP协议#define PROTOCOL_UDP 1 //UDP协议#define PROTOCOL_MULTICAST 2 //组播协议 HWND hWndDisplay; //显示窗口 unsigned long bPlayStart; //是否显示 0-不显示 1-显示 unsigned long dwBackFrameCount; //缓冲帧数 unsigned long dwReserved; //保留}DVSNET_CHANNEL_INFO;DVSNET_API int __stdcall DVSNET_OpenChannel(HANDLE hServer,unsigned long nChannel,DVSNET_CHANNEL_INFO *pChannelInfo,HANDLE *phChannel);我转成delphi//打开前端通道type DVSNET_CHANNEL_INFO = ^tagDVSNET_CHANNEL_INFO; tagDVSNET_CHANNEL_INFO = packed record lStructSize: dword; //结构大小,设置为sizeof(DVSNET_CHANNEL_INFO) dwStreamNo: dword; //码流号(用于双码流) nProtocol: dword; //网络协议//数据发送协议 PROTOCOL_TCP: integer; //TCP协议 0 PROTOCOL_UDP: integer; //UDP协议 1 PROTOCOL_MULTICAST: integer; //组播协议 2 hWndDisplay: hwnd; //显示窗口 bPlayStart: dword; //是否显示 0-不显示 1-显示 dwBackFrameCount: dword; //缓冲帧数 dwReserved: dword; //保留 end;function DVSNET_OpenChannel(hServer: THandle; nChannel: Dword; pChannelInfo: DVSNET_CHANNEL_INFO; phChannel: PHandle): Integer; stdcall;在窗口中应用procedure TFrmdvsnetclient.RzBitBtn3Click(Sender: TObject);var ChannelInfo: DVSNET_CHANNEL_INFO; hWndf: hwnd;begin//----打开通道 New(ChannelInfo); ChannelInfo.PROTOCOL_TCP := 0; ChannelInfo.PROTOCOL_UDP := 1; ChannelInfo.PROTOCOL_MULTICAST := 2; DVSNET_OpenChannel(Serverwnp, 0, @ChannelInfo, @Channelwnp); showmessage(inttostr(DVSNET_OpenChannel(Serverwnp, 0, @ChannelInfo, @Channelwnp))); end;返回的结果是错误的,提示非法的参数,哪位大哥帮看看呢