halcon 嵌入到MFC图像控件上

  picture control                                                            IDC_BMPWINDOW

设置显示句柄

 CRect rtWindow;
 HWND hImgWnd = GetDlgItem( IDC_BMPWINDOW)->m_hWnd;
 GetDlgItem( IDC_BMPWINDOW)->GetClientRect(&rtWindow);
 OpenWindow(rtWindow.left, rtWindow.top, rtWindow.Width(), rtWindow.Height(), (Hlong)hImgWnd, "visible", "", &m_htWindow);
 SetPart(m_htWindow, 0, 0, IMG_HEIGHT-1, IMG_WIDTH-1);//其中 IMG_HEIGHT 、IMG_WIDTH分别为512,,400.这个可以自行定义。

显示

 CString str;
 str=m_editOpenDir;
 char* ch=(char*)LPCTSTR(str);
 ReadImage(&m_hoImage, ch);
 DispObj(m_hoImage, m_htWindow); 



你可能感兴趣的:(Halcon)