加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

[VB.NET].net平台调用API问题

发布时间:2020-12-16 23:46:02 所属栏目:大数据 来源:网络整理
导读:.net平台调用API问题 在vb.net下,如何为API函数使用的数据结构中的字符串分配指定的大小 __________________________________________________________________________ 和以往VB是一样的阿 _____________________________________________________________
.net平台调用API问题 在vb.net下,如何为API函数使用的数据结构中的字符串分配指定的大小 __________________________________________________________________________ 和以往VB是一样的阿 __________________________________________________________________________ Dim s As New String( " ",10) __________________________________________________________________________ < MarshalAs( UnmanagedType.ByValTStr,SizeConst := 128 )> _ Public versionString As String __________________________________________________________________________ 不是固定大小,并且要求字符串的内容可变 __________________________________________________________________________ ?? 没听明白 __________________________________________________________________________ versionString长度是可变的,在程序中分配大小,而且规定中说string类型的变量内容好象是不能改变的 __________________________________________________________________________ 调用dll 参数主要要符合dll的要求, 另外你的.net调用dll需要封送,只是传给dll参数,在传之前变不变有什么关系, 贴出你的dll引出函数的声明, __________________________________________________________________________ // Decode Frame,call it to decode a complete YUV Frame. // This is the main function of the Decoder SDK // The pFrameYuv must be allocated by the user,except if motion parser Flag is set to 0. DLL_API int SdkSsnDecDecodeStream(SdkDec_t *pSdkDec,FrameDec_t *pFrameYuv); 该函数需要的回调函数是 // GetPacket CallBack: The user shall define this function. // The Smartsight Decoder will call it when it request bytes. // RETURN: The number of bytes in the Packet or -1 to attemp a close of the decoder. typedef int (*pGETPACKET_CB)( void *pContext,// User Context unsigned char **ppBufAdr); // Output Var: Address of the packet to read __________________________________________________________________________ SdkDec_t *pSdkDec,FrameDec_t *pFrameYuv 自定义的结构?? __________________________________________________________________________ 需要自己定义,其中FrameDec_t中包含有三个*char类型的数据,在调用该函数之前要对其进行内存分配 __________________________________________________________________________ 数据类型要做一下调整,具体参照变量类型表 __________________________________________________________________________ 如何调整呢,结构如下 // Frame Structure to retrieve all the info about a frame,// before and after decompression // The user shall fill a part of this structure before giving it to the encoer typedef struct FrameDec_s { unsigned char *pY; // Pointer to the visible Y-Plane unsigned char *pU; // Pointer to the visible U-Plane unsigned char *pV; // Pointer to the visible V-Plane unsigned long FieldOverField; // 1 if the frame is store Field over Field // Useful for buffers with sizes > 288 only. unsigned long FrameType; // I,P or B unsigned long TimeRef; // Time reference (8 bits) unsigned long TimeIncre; // Vop Time Increment in tick units unsigned long YStride; // Y Stride of the allocated buffer unsigned long UVStride; // UV Stride of the allocated buffer unsigned long YBufHeight; // Y Height of the allocated buffer unsigned long BufferSize; // Size of the Y plane (As allocate by user),before compression unsigned long Height; // Height of the Frame,after de-compression,real Height unsigned long Width; // Width of the Frame,real Width unsigned long MeanQuant; // Mean Quantizer decoded void *pUserInfo; // Pointer to a user info,if required } FrameDec_t; __________________________________________________________________________ 代码太长,问题不明,不好直接回答建议可那看这片帮助 ms-help://MS.MSDNQTR.2003FEB.2052/cpguide/html/cpconmarshalingclassesstructuresunions.htm __________________________________________________________________________ 还是谢谢了,我的问题实在太多.. __________________________________________________________________________ 其实一句话概括,结构中的字符串如何分配内存 __________________________________________________________________________ unsigned char *pY; // Pointer to the visible Y-Plane unsigned char *pU; // Pointer to the visible U-Plane unsigned char *pV; // Pointer to 这三个参数可以试试stringbuilder __________________________________________________________________________ 字符串是结构的有效成员;但是,StringBuilder 缓冲区在结构中是无效的。 是什么意思 __________________________________________________________________________ lz与到这种事情还不如用C++.net写个dll然后让vb调用算了,这样转来转去多头痛 __________________________________________________________________________ 说的没错,我真的被转晕了,平台调用时又出现很多问题 总提示错误“未将对象引用设置到对象的实例” __________________________________________________________________________

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读