海康visionmaster-VM 嵌入:嵌入用户软件界面的方法

描述

环境:VM4.0.0 + VS2015 及以上

现象:将 VM 整体嵌入到客户软件界面中?

解答

将 VM 软件整体嵌入到客户软件中,需要利用 Panel 控件,并且需要先启动 VM 软件,具

体代码如下:

C#

DllImport("User32.dll", EntryPoint = "SetParent")

public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNew

Parent);

DllImport("user32.dll", CharSet = CharSet.Auto)

public static extern int MoveWindow(IntPtr hWnd, int x, int y, int n

Width, int nHeight, bool BRePaint);

// Start the process

p = System.Diagnostics.Process.Start

(@"D: \VisionMaster4.0.0\Applications\VisionMaster.exe");

// Wait for process to be created and enter idle condition

p.WaitForInputIdle();

// Get the main handle

appWin = p.MainWindowHandle;

//需要等待 p 启动,可自行判断,可加上 Thread.Sleep(10000);

SetParent(appWin, panel1.Handle);//this 在这里是 Panel 控件

MoveWindow(appWin, 0, 0, this.panel1.Width, this.panel1.Height, tru

e);

最终效果如下图所示,VM 就整体嵌入到客户软件的 Panel 空间中,并且可以保持 VM 所

具备的功能

相关推荐
君不见,青丝成雪3 分钟前
Hadoop技术栈(四)HIVE常用函数汇总
大数据·数据库·数据仓库·hive·sql
arron88999 分钟前
YOLOv8n-pose 模型使用
人工智能·深度学习·yolo
AI人工智能+1 小时前
一种融合AI与OCR的施工许可证识别技术,提升工程监管效率,实现自动化、精准化处理。
人工智能·自动化·ocr·施工许可证识别
Hy行者勇哥2 小时前
Python 与 VS Code 结合操作指南
开发语言·python
大力水手(Popeye)2 小时前
Pytorch——tensor
人工智能·pytorch·python
ygy.白茶3 小时前
从电影分类到鸢尾花识别
人工智能
不羁。。5 小时前
【撸靶笔记】第七关:GET - Dump into outfile - String
数据库·笔记·oracle
AI_gurubar6 小时前
大模型教机器人叠衣服:2025年”语言理解+多模态融合“的智能新篇
人工智能·机器人
飞翔的佩奇6 小时前
【完整源码+数据集+部署教程】表盘指针检测系统源码和数据集:改进yolo11-CA-HSFPN
python·yolo·计算机视觉·数据集·yolo11·表盘指针检测
yangchanghua1117 小时前
pgsql 如何查询今天范围内的数据(当天0点0分0秒 - 当天23点59分59秒....)
数据库·pgsql