HALCON Reference Manual 10.0.2
Table of Contents / Graphics / Window ClassesClassesClasses | | | Operators

set_window_dcset_window_dcset_window_dcSetWindowDcSetWindowDc (Operator)

Name

set_window_dcset_window_dcset_window_dcSetWindowDcSetWindowDc — Set the device context of a virtual graphics window (Windows NT).

Signature

set_window_dc( : : WindowHandle, WINHDC : )

Herror set_window_dc(const Hlong WindowHandle, const Hlong WINHDC)

Herror T_set_window_dc(const Htuple WindowHandle, const Htuple WINHDC)

Herror set_window_dc(const HTuple& WindowHandle, const HTuple& WINHDC)

void HWindow::SetWindowDc(const HTuple& WINHDC) const

void HOperatorSetX.SetWindowDc(
[in] VARIANT WindowHandle, [in] VARIANT WINHDC)

void HWindowX.SetWindowDc([in] Hlong WINHDC)

static void HOperatorSet.SetWindowDc(HTuple windowHandle, HTuple WINHDC)

void HWindow.SetWindowDc(IntPtr WINHDC)

Description

set_window_dcset_window_dcset_window_dcSetWindowDcSetWindowDc sets the device context of a window previously opened with new_extern_windownew_extern_windownew_extern_windowNewExternWindowNewExternWindow. All output (disp_regiondisp_regiondisp_regionDispRegionDispRegion, disp_imagedisp_imagedisp_imageDispImageDispImage, etc.) is done in the window with this device context.

The parameter WINHDCWINHDCWINHDCWINHDCWINHDC contains the device context of the window in which HALCON should output its data. This device context is used in all output routines of HALCON.

Attention

The window WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle has to be created with new_extern_windownew_extern_windownew_extern_windowNewExternWindowNewExternWindow beforehand.

Parallelization

Parameters

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHWindowX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Window identifier.

WINHDCWINHDCWINHDCWINHDCWINHDC (input_control)  pointer HTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

devicecontext of WINHWnd.

Restriction: WINHDC != 0

Example (C++)

HTuple m_tHalconWindow ;
Hobject m_objImage ;

WM_CREATE:
/* here you should create your extern halcon window*/
HTuple tWnd ;
set_check("~father") ;
tWnd = (INT)(m_hWnd) ;
new_extern_window(tWnd, 0, 0, sizeTotal.cx, sizeTotal.cy,
                  &m_tHalconWindow) ;
set_check("father") ;

WM_PAINT:
/* here you can draw halcon objects */
if (m_thWindow != -1) {
  HTuple tDC ;
  /* don't forget to set the dc !! */
  tDC = (INT)GetWindowDC(Control) ;
  set_window_dc(m_tHalconWindow,tDC) ;
  disp_obj(pDoc->m_objImage, m_tHalconWindow) ;
  /* release the graphic objects */
  set_window_dc(m_tHalconWindow, 0) ;
  ReleaseDC((INT)tDC) ;
}

WM_CLOSE:
/* close the halcon window */
if (m_tHalconWindow != -1) {
      close_window(m_tHalconWindow) ;
}

Result

If the values of the specified parameters are correct, set_window_dcset_window_dcset_window_dcSetWindowDcSetWindowDc returns 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors

new_extern_windownew_extern_windownew_extern_windowNewExternWindowNewExternWindow

Possible Successors

disp_imagedisp_imagedisp_imageDispImageDispImage, disp_regiondisp_regiondisp_regionDispRegionDispRegion

See also

new_extern_windownew_extern_windownew_extern_windowNewExternWindowNewExternWindow, disp_regiondisp_regiondisp_regionDispRegionDispRegion, disp_imagedisp_imagedisp_imageDispImageDispImage, disp_colordisp_colordisp_colorDispColorDispColor, set_lutset_lutset_lutSetLutSetLut, query_colorquery_colorquery_colorQueryColorQueryColor, set_colorset_colorset_colorSetColorSetColor, set_rgbset_rgbset_rgbSetRgbSetRgb, set_hsiset_hsiset_hsiSetHsiSetHsi, set_pixelset_pixelset_pixelSetPixelSetPixel, set_grayset_grayset_graySetGraySetGray, set_partset_partset_partSetPartSetPart, set_part_styleset_part_styleset_part_styleSetPartStyleSetPartStyle, query_window_typequery_window_typequery_window_typeQueryWindowTypeQueryWindowType, get_window_typeget_window_typeget_window_typeGetWindowTypeGetWindowType, set_window_typeset_window_typeset_window_typeSetWindowTypeSetWindowType, get_mpositionget_mpositionget_mpositionGetMpositionGetMposition, set_tpositionset_tpositionset_tpositionSetTpositionSetTposition, set_window_extentsset_window_extentsset_window_extentsSetWindowExtentsSetWindowExtents, get_window_extentsget_window_extentsget_window_extentsGetWindowExtentsGetWindowExtents, set_window_attrset_window_attrset_window_attrSetWindowAttrSetWindowAttr, set_checkset_checkset_checkSetCheckSetCheck, set_systemset_systemset_systemSetSystemSetSystem

Module

Foundation


Table of Contents / Graphics / Window ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH