vc转vb.net的问题
用海康的sdk开发,遇到几个问题 我用的是2005.vc中函数声明
BOOL NET_DVR_GetDVRConfig(
LONG lUserID,
DWORD dwCommand,
LONG lChannel,
LPVOID lpOutBuffer,
DWORD dwOutBufferSize,
LPDWORD lpBytesReturned
);
lpOutBuffer 传入的是NET_DVR_COMPRESSIONCFG_EX 。定义如下
struct{
DWORD dwSize;
NET_DVR_COMPRESSION_INFO_EX struRecordPara;
NET_DVR_COMPRESSION_INFO_EX struNetPara;
}NET_DVR_COMPRESSIONCFG_EX, *LPNET_DVR_COMPRESSIONCFG_EX;
dwOutBufferSize 传入的是NET_DVR_COMPRESSIONCFG_EX的长度,函数里面就用sizeof取得。
在这个结构体里面嵌套了2个结构体,定义如下
struct{
BYTE byStreamType;
BYTE byResolution;
BYTE byBitrateType;
BYTE byPicQuality;
DWORD dwVideoBitrate;
DWORD dwVideoFrameRate;
WORD wIntervalFrameI;
BYTE byIntervalBPFrame;
BYTE byRes;
}NET_DVR_COMPRESSION_INFO_EX, *LPNET_DVR_COMPRESSION_INFO_EX;
vb.net中我声明
Public Declare Function NET_DVR_GetDVRConfig Lib "HCNetSDK.dll" (ByVal lUserID As Integer, ByVal dwCommand As Integer, ByVal lChannel As Integer, ByRef lpOutBuffer As Object, ByVal dwOutBufferSize As Integer, ByRef dwReturned As Integer) As Integer
结构体声明如下
Structure NET_DVR_COMPRESSION_INFO_EX
Public byStreamType As Byte
Public byResolution As Byte
Public byBitrateType As Byte
Public byPicQuality As Byte
Public dwVideoBitrate As UInteger
Public dwVideoFrameRate As UInteger
Public wIntervalFrameI As UShort
Public byIntervalBPFrame As Byte
Public byRes As Byte
End Structure
=Structure NET_DVR_COMPRESSIONCFG_EX
Public dwSize As Integer
Public struRecordPara As NET_DVR_COMPRESSION_INFO_EX
Public struNetPara As NET_DVR_COMPRESSION_INFO_EX
=End Structure
调用方法如下
Private compression As NET_DVR_COMPRESSIONCFG_EX
NET_DVR_GetDVRConfig(hLoginId, 204, 1, compression, Len(compression), dwreturn)
结构体compression 中无法得到获取的值 ,也不知道是不是成功了。请教下 以上vb方法使用上有没有问题
--------------------编程问答-------------------- NET_DVR_COMPRESSIONCFG_EX 直接在函数式声明成这个,而不用Object, 貌似以前碰上过类似的问题
不过我答得不权威....猜测...如果不对当帮顶了 --------------------编程问答-------------------- 应该到.NET版问问 --------------------编程问答-------------------- 。net那边 发了 没人理。。。。我也不是很懂vb 只是模仿着转转看 object 不用的话会报错 --------------------编程问答-------------------- 两头和vb不搭边 --------------------编程问答-------------------- jiefen --------------------编程问答-------------------- 现在 .Net 流行,你完全可以向提供商要一个 .Net 的调用样例。
补充:VB , 基础类