1.新建一个MFC 工程,Halcon 为64位,所以先将工程改为x64
> Vc++ 目录设置包含目录和库目录
包含目录
库目录
c/c++ ->常规
链接器 ->常规
> 链接器输入
在窗口中添加头文件
#include "HalconCpp.h"
#include "Halcon.h"
using namespace HalconCpp;
拖动控件
Button中添加
void CSkinDemoDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
HObject ho_Image;
HTuple m_hWindowHandle;
HTuple hv_Width, hv_Height;
ReadImage(&ho_Image, "1.png");
GetImageSize(ho_Image, &hv_Width, &hv_Height);
GetDlgItem(IDC_STATIC)->MoveWindow(0, 0, hv_Width, hv_Height);
HWND hWnd = GetDlgItem(IDC_STATIC)->m_hWnd;
OpenWindow(0, 0, hv_Width, hv_Height, (LONG)hWnd, "visible", "", &m_hWindowHandle);
HDevWindowStack::Push(m_hWindowHandle);
if (HDevWindowStack::IsOpen)
{
DispObj(ho_Image, HDevWindowStack::GetActive());
}
}
静态库文件添加项目中