Hlong MainWndID =(Hlong) m_hWnd;

CWnd * pWnd = GetDlgItem( IDC_STATIC);

open_window(0,0, Width/2, Height/2,MainWndID,"visible","",&WindowHandle);

改为:

CRect rect;
CWnd * pWnd = GetDlgItem( IDC_STATIC);
Hlong MainWndID = (Hlong)pWnd->m_hWnd;//获取父窗口句柄
pWnd->GetWindowRect(&rect);

open_window(0,0, rect.Width(), rect.Height(),MainWndID,"visible","",&WindowHandle);

总的代码如下:

void CfirstpageDlg::OnBnClickedButtonShowimage()
{
using namespace Halcon;

// Local iconic variables
Hobject Image;
// HTuple HWindowID;
CRect rect;
CWnd * pWnd = GetDlgItem( IDC_STATIC);
Hlong MainWndID = (Hlong)pWnd->m_hWnd;//获取父窗口句柄
pWnd->GetWindowRect(&rect);
// Local control variables
HTuple Pointer, Type, Width, Height, WindowHandle;

read_image(&Image, "C:/Users/Hou/Documents/Tencent Files/458927028/FileRecv/1.bmp");

get_image_pointer1(Image, &Pointer, &Type, &Width, &Height);

set_window_attr("background_color","black");
open_window(0,0, rect.Width(), rect.Height(),MainWndID,"visible","",&WindowHandle);

disp_obj(Image, WindowHandle);


}

图像显示如下:

 

posted on 2017-05-12 18:14 吃土豆的章鱼 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/salmoner/p/6846780.html

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐