Skip to content

new_extern_windowNewExternWindowNewExternWindownew_extern_windowT_new_extern_window🔗

Short description🔗

new_extern_windowNewExternWindowNewExternWindownew_extern_windowT_new_extern_window — Create a virtual graphics window under Windows.

Signature🔗

new_extern_window( pointer WINHWnd, rectangle.origin.y Row, rectangle.origin.x Column, rectangle.extent.x Width, rectangle.extent.y Height, out window WindowHandle )void NewExternWindow( const HTuple& WINHWnd, const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, HTuple* WindowHandle )static void HOperatorSet.NewExternWindow( HTuple WINHWnd, HTuple row, HTuple column, HTuple width, HTuple height, out HTuple windowHandle )def new_extern_window( winhwnd: int, row: int, column: int, width: int, height: int ) -> HHandle

Herror T_new_extern_window( const Htuple WINHWnd, const Htuple Row, const Htuple Column, const Htuple Width, const Htuple Height, Htuple* WindowHandle )

void HWindow::NewExternWindow( void* WINHWnd, Hlong Row, Hlong Column, Hlong Width, Hlong Height )

void HWindow.NewExternWindow( IntPtr WINHWnd, int row, int column, int width, int height )

Description🔗

new_extern_windowNewExternWindow opens a new virtual window. Note that this only works on Windows systems and drawing objects are not supported.

Virtual means that a new window will not be created, but the window whose window handle is given in the parameter WINHWndWINHWndwinhwnd is used to perform output of gray value data, regions, graphics as well as to perform textual output.

All operators that allow the user to define graphical primitives through mouse interactions, like for example draw_rectangle1DrawRectangle1, do not work on external windows. The following operators can be used:

You may query current set values by calling operators like get_shapeGetShape. As some parameters are specified through the hardware (Resolution/Colors), you may query current available resources by calling operators like query_colorQueryColor.

The parameter WINHWndWINHWndwinhwnd is used to pass the window handle of the window in which output should be done.

The origin of the coordinate system of the window resides in the upper left corner (coordinates: (0,0)). The row index grows downward (maximum: Heightheightheight-1), the column index grows to the right (maximal: Widthwidthwidth-1).

You may use the value -1-1 for parameters Widthwidthwidth and Heightheightheight. This means, that the corresponding value is chosen automatically. In particular, this is important if the aspect ratio of the pixels is not 1.0 (see set_systemSetSystem). If one of the two parameters is set to -1-1, it will be chosen through the size which results out of the aspect ratio of the pixels. If both parameters are set to -1-1, they will be set to the current image format.

The position and size of a window may change during runtime of a program, e.g., through external influences (window manager). With the operator set_window_extentsSetWindowExtents, you can change the size of the (external) widow via the program. Note that set_window_extentsSetWindowExtents offers to change the position as well, but you cannot change the position of an external window under Windows.

Opening a window causes the assignment of a default font. It is used in connection with operators like write_stringWriteString and you may change it by performing set_fontSetFont after calling open_windowOpenWindow. On the other hand, you have the possibility to specify a default font by calling set_system(::'default_font',<Fontname>:) before opening a window (and all following windows; see also query_fontQueryFont).

You may set the color of graphics and font, which is used for output operators like disp_regionDispRegion or disp_circleDispCircle, by calling set_rgbSetRgb, set_hsiSetHsi or set_graySetGray.

The content of the window is not saved, if other windows overlap the window. This must be done in the program code that handles the window in the calling program.

For graphical output (disp_imageDispImage,disp_regionDispRegion, etc.) you may adjust the window by calling the operator set_partSetPart in order to represent a logical clipping of the image format. In particular this implies that only this part (appropriately scaled) of images and regions is displayed. Before you close your window, you have to close the HALCON-window.

Attention🔗

Note that parameters as Rowrowrow, Columncolumncolumn, Widthwidthwidth and Heightheightheight are constrained through the output device, i.e., the size of the Windows NT desktop. Furthermore, be aware that all operators that allow the user to define graphical primitives through mouse interactions, like for example draw_rectangle1DrawRectangle1, do not work on external windows.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters🔗

WINHWndWINHWndwinhwnd (input_control) pointer → (integer)HTuple (Hlong)HTuple (IntPtr)intHtuple (Hlong)

Windows window handle of a previously created window.

Restriction: WINHWnd != 0

Rowrowrow (input_control) rectangle.origin.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Row coordinate of upper left corner.

Default: 00
Restriction: Row >= 0

Columncolumncolumn (input_control) rectangle.origin.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Column coordinate of upper left corner.

Default: 00
Restriction: Column >= 0

Widthwidthwidth (input_control) rectangle.extent.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the window.

Default: 512512
Restriction: Width > 0 || Width == -1

Heightheightheight (input_control) rectangle.extent.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the window.

Default: 512512
Restriction: Height > 0 || Height == -1

WindowHandlewindowHandlewindow_handle (output_control) window → (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Window handle.

Example🔗

(C++)

// Needs to be embedded into an application framework,
// see examples/cpp/mfc/MatchingExtWin.

Result🔗

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

Combinations with other operators🔗

Combinations

Possible predecessors

reset_obj_dbResetObjDb

Possible successors

set_colorSetColor, query_window_typeQueryWindowType, get_window_typeGetWindowType, set_window_typeSetWindowType, get_mpositionGetMposition, set_tpositionSetTposition, set_tshapeSetTshape, set_window_extentsSetWindowExtents, get_window_extentsGetWindowExtents, query_colorQueryColor, set_checkSetCheck, set_systemSetSystem

Alternatives

open_windowOpenWindow

See also

open_windowOpenWindow, disp_regionDispRegion, disp_imageDispImage, disp_colorDispColor, set_lutSetLut, query_colorQueryColor, set_colorSetColor, set_rgbSetRgb, set_hsiSetHsi, set_pixelSetPixel, set_graySetGray, set_partSetPart, set_part_styleSetPartStyle, query_window_typeQueryWindowType, get_window_typeGetWindowType, set_window_typeSetWindowType, get_mpositionGetMposition, set_tpositionSetTposition, set_window_extentsSetWindowExtents, get_window_extentsGetWindowExtents, set_window_attrSetWindowAttr, set_checkSetCheck, set_systemSetSystem

Module🔗

Foundation