吃土豆的章鱼

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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  吃土豆的章鱼  阅读(216)  评论(0编辑  收藏  举报