调用第三方动态库,对方提供的函数
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;
}
可是总是报一个错误 “尝试读取或写入受保护的内存。这通常指示其他内存已损坏”
高手帮忙 急!!!
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;
}
可是总是报一个错误 “尝试读取或写入受保护的内存。这通常指示其他内存已损坏”
高手帮忙 急!!!
解决方案 »
- C#跨线程的参数传递问题
- 一个网络通信的问题(网络通信达人请进)
- C#中怎么用FindAll实现SQL语句and in()方式的查找?
- C#.net ,webform,Substring() 提取指定字符的,下划线问题
- *** 问一个简单的小问题(winform),在dataGrid 控件 中,如何动态定义 某一列的显示宽度。
- 请问用C#在AD(Active Directory)添加了一个用户,如何用C#启用它???
- 请问:有关绘图.
- 如何实现DataGrid中的列可以编辑但又不出现讨厌的空行
- 请教,c#.net 如何获得richtextbox中文本行数?
- 不拖拉控件而直接写代码怎么显示不了控件呢?
- 在MVC里如何获得页面上的控件名称?
- 这个C#模板的程序哪里错了?高手帮忙改一下
public static extern int StartVideoPreview(IntPtr hChannelHandle, IntPtr WndHandle, IntPtr rect, bool bOverlay, int VideoFormat, int FrameRate);
{
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));
自己对照下,就差不多了