海康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 所

具备的功能

相关推荐
Cengineering2 分钟前
sqlalchemy 加速数据库操作
数据库
小叶学C++10 分钟前
【C++】类与对象(下)
java·开发语言·c++
ac-er888811 分钟前
PHP“===”的意义
开发语言·php
Funny_AI_LAB21 分钟前
MetaAI最新开源Llama3.2亮点及使用指南
算法·计算机视觉·语言模型·llama·facebook
Cikiss24 分钟前
微服务实战——平台属性
java·数据库·后端·微服务
jk_10130 分钟前
MATLAB中decomposition函数用法
开发语言·算法·matlab
weixin_4640780730 分钟前
C#串口温度读取
开发语言·c#
Langchain30 分钟前
不可错过!CMU最新《生成式人工智能大模型》课程:从文本、图像到多模态大模型
人工智能·自然语言处理·langchain·大模型·llm·大语言模型·多模态大模型
无敌の星仔33 分钟前
一个月学会Java 第2天 认识类与对象
java·开发语言
小小不董37 分钟前
《Linux从小白到高手》理论篇:深入理解Linux的网络管理
linux·运维·服务器·数据库·php·dba