懂VC++的高手来 急!!

smaworm 2009-05-19 04:20:14
调用第三方动态库,对方提供的函数
int __stdcall StartVideoPreview(HANDLE hChannelHandle,HWND WndHandle, RECT *rect,BOOLEAN bOverlay, int VideoFormat, int FrameRate)
HANDLE hChannelHandle;通道句柄
HWND WndHandle;显示窗口句柄
RECT *rect;显示窗口内的矩形区域
BOOLEAN bOverlay;是否启用 Overlay预览模式*
int VideoFormat;视频预览格式(目前无效)
int FrameRate;视频预览帧率(PAL:1-25,NTSC:1-30)

我用C#是这么写的
SysJianKong.CSRect rc = new SysJianKong.CSRect();
rc.left = 0;
rc.top = 5;
rc.right = this.panel1.Size.Width;
rc.bottom = this.panel1.Size.Height;
IntPtr intptr = SysJianKong.ChannelOpen(4)
SysJianKong.StartVideoPreview(intptr, this.panel1.Handle, rc, false, 0,25);
//class SysJianKong 中定义
[DllImport("DS40xxSDK.dll", EntryPoint = "StartVideoPreview")]
public static extern int StartVideoPreview(IntPtr hChannelHandle, IntPtr WndHandle, CSRect rect, bool bOverlay, int VideoFormat, int FrameRate);

public struct CSRect
{
public int bottom;
public int left;
public int right;
public int top;
}


可是总是报一个错误 “尝试读取或写入受保护的内存。这通常指示其他内存已损坏”
高手帮忙 急!!!
...全文
56 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
kissyou886 2009-05-19
  • 打赏
  • 举报
回复
推荐一篇文章给你看:http://www.cnblogs.com/yiki/archive/2008/10/29/1321848.html
自己对照下,就差不多了
Tassadar1979 2009-05-19
  • 打赏
  • 举报
回复
public struct CSRectSharp
{
public int bottom;
public int left;
public int right;
public int top;
}

StartVideoPreview(hChannelHandle, WndHandle, rect, bOverlay, VideoFormat, FrameRate);
CSRectSharp csr = (CSRectSharp)Marshal.PtrToStructure(rect , typeof(CSRectSharp));
yanxiaoyudotnet 2009-05-19
  • 打赏
  • 举报
回复
我也正在做类似的视频监控项目 有兴趣加下QQ85751330有问题一起交流
Tassadar1979 2009-05-19
  • 打赏
  • 举报
回复
[DllImport("DS40xxSDK.dll", EntryPoint = "StartVideoPreview")]
public static extern int StartVideoPreview(IntPtr hChannelHandle, IntPtr WndHandle, IntPtr rect, bool bOverlay, int VideoFormat, int FrameRate);
smaworm 2009-05-19
  • 打赏
  • 举报
回复
在c#中应该怎么写呢? 知道的帮忙 谢谢!
ztenv 2009-05-19
  • 打赏
  • 举报
回复
RECT *rect//这里是指针呀

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧