initgraph
This function is used to initialize the graphics window.
HWND initgraph(
int width,
int height,
int flag = NULL
);
Parameters
width
The width of the graphics window.
height
The height of the graphics window.
flag
The style of the drawing window, the default value is NULL. Can be the following values.
Value | Description |
---|---|
EX_DBLCLKS | Support for mouse double-click events in the graphics window. |
EX_NOCLOSE | Disable the close button of the graphics window. |
EX_NOMINIMIZE | Disable the minimize button of the graphics window. |
EX_SHOWCONSOLE | Keep the original console window. |
Return Value
Returns the handle to the graphics window created.
Examples
The following code snippet creates a graphics window with a size 640 * 480.
initgraph(640, 480);
The following snippets create a drawing window with a size of 640x480 and display the console window at the same time:
initgraph(640, 480, EX_SHOWCONSOLE);
The following code snippet creates a graphics window with a size 640 * 480, displays the console window, and disables the close button:
initgraph(640, 480, EX_SHOWCONSOLE | EX_NOCLOSE);