C# 视频监控系列(7):服务器端——封装API(下) [DS40xxSDK.dll] (下)
2009-04-08 08:23:46 来源:WEB开发网修改记录
1. 2009-3-16,修改前本文备份:http://file.ddvip.com/2009_04/1239186012_ddvip_4371.rar
1.1 去掉了《4.解码卡API 》,暂时用不上也占文章太多行数,暂时去掉了。
1.2 GetSDKVersion 结构体一般需要加ref
VC++:int __stdcall GetSDKVersion(PVERSION_INFO VersionInfo)
C#[改前]:public static extern int GetSDKVersion(PVERSION_INFO VersionInfo);
C#[改后]:public static extern int GetSDKVersion(ref PVERSION_INFO VersionInfo);
1.3 抓图函数GetJpegImage ,没注意参数Size前面的*
VC++:int __stdcall GetJpegImage(HANDLE hChannelHandle,UCHAR *ImageBuf, ULONG *Size,UINT nQuality)
C#[改前]:public static extern int GetJpegImage(IntPtr hChannelHandle, byte[] ImageBuf, ulong Size, uint nQuality);
C#[改后]:public static extern int GetJpegImage(IntPtr hChannelHandle, byte[] ImageBuf, out int Size, uint nQuality);
1.4 抓图函数GetOriginalImage,没注意参数Size前面的*
VC++:int __stdcall GetOriginalImage(HANDLE hChannelHandle, UCHAR *ImageBuf, ULONG *Size)
C#[改前]:public static extern int GetOriginalImage(IntPtr hChannelHandle, byte[] ImageBuf, ulong Size);
C#[改后]:public static extern int GetOriginalImage(IntPtr hChannelHandle, byte[] ImageBuf, out int Size);
小节:一般结构体对应翻译的话都要加ref;一般数值类型的加*对应都要加out。
2. 2009-3-19
2.1 GetBoardDetail
VC++原型:int __stdcall GetBoardDetail(UINT boardNum,DS_BOARD_DETAIL *pBoardDetail)
C# 改前:public static extern int GetBoardDetail(uint boardNum, DS_BOARD_DETAIL pBoardDetail);
C# 改后:public static extern int GetBoardDetail(uint boardNum, ref DS_BOARD_DETAIL pBoardDetail);
2.2 GetDspDetail
VC++原型:int __stdcall GetDspDetail(UINT dspNum,DSP_DETAIL *pDspDetail)
C# 改前:public static extern int GetDspDetail(uint dspNum, DSP_DETAIL pDspDetail);
C# 改后:public static extern int GetDspDetail(uint dspNum, ref DSP_DETAIL pDspDetail);
结束
在后续的文章中本文中API仍然可能会变动,毕竟我们用的只是其中的一部分,我会随时更新,感谢继续关注。本来是作为一篇文章发布的,发现代码过长,插入都费老半天,所有拆开成上下了!!
更多精彩
赞助商链接