Window – Giavapps Windows API

 

 

api_window_create(ParentHandle, X, Y, W, H, Flags, ExFlags) This function creates a window.

ParentHandle: parent handle.
X: x coordinate. You can also use CW_USEDEFAULT flag for this argument.
Y: y coordinate.You can also use CW_USEDEFAULT flag for this argument.
W: width.You can also use CW_USEDEFAULT flag for this argument.
H: height.You can also use CW_USEDEFAULT flag for this argument.
Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".

 

Flags

 

WS_BORDER The window has a thin-line border.

WS_CAPTION The window has a title bar (includes the WS_BORDER style).

WS_CHILD The window is a child window. A window with this style cannot have a menu bar. This style cannot be used with the WS_POPUP style.

WS_CHILDWINDOW Same as the WS_CHILD style.

WS_CLIPCHILDREN Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window.

WS_CLIPSIBLINGS Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.

WS_DISABLED The window is initially disabled. A disabled window cannot receive input from the user.

WS_DLGFRAME The window has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar.

WS_GROUP The window is the first control of a group of controls. The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.

WS_HSCROLL The window has a horizontal scroll bar.

WS_ICONIC The window is initially minimized. Same as the WS_MINIMIZE style.

WS_MAXIMIZE The window is initially maximized.

WS_MAXIMIZEBOX The window has a maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.

WS_MINIMIZE The window is initially minimized. Same as the WS_ICONIC style.

WS_MINIMIZEBOX The window has a minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.

WS_OVERLAPPED The window is an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style.

WS_OVERLAPPEDWINDOW The window is an overlapped window. Same as the WS_TILEDWINDOW style.

WS_POPUP The windows is a pop-up window. This style cannot be used with the WS_CHILD style.

WS_POPUPWINDOW The window is a pop-up window. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.

WS_SIZEBOX The window has a sizing border. Same as the WS_THICKFRAME style.

WS_SYSMENU The window has a window menu on its title bar. The WS_CAPTION style must also be specified.

WS_TABSTOP The window is a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.

WS_THICKFRAME The window has a sizing border. Same as the WS_SIZEBOX style.

WS_TILED The window is an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style.

WS_TILEDWINDOW The window is an overlapped window. Same as the WS_OVERLAPPEDWINDOW style.

WS_VISIBLE The window is initially visible.

WS_VSCROLL The window has a vertical scroll bar.

 

Extended Flags

 

WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-drop filesThere were some difficulties in implementing drag-drop feature. Unfortunately it isn't supported in this extension!.

WS_EX_APPWINDOW Forces a top-level window onto the taskbar when the window is visible.

WS_EX_CLIENTEDGE The window has a border with a sunken edge.

WS_EX_COMPOSITED Paints all descendants of a window in bottom-to-top painting order using double-buffering.

Windows 2000:  This style is not supported.

WS_EX_CONTEXTHELP The title bar of the window includes a question mark. When the user clicks the question mark, the cursor changes to a question mark with a pointer. WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.

WS_EX_CONTROLPARENT The window itself contains child windows that should take part in dialog box navigation. If this style is specified, the dialog manager recurses into children of this window when performing navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic.

WS_EX_DLGMODALFRAME The window has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the Flags parameter.

WS_EX_LAYERED The window is a layered window.

Windows 8:  The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.

WS_EX_LAYOUTRTL If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the horizontal origin of the window is on the right edge. Increasing horizontal values advance to the left.

WS_EX_LEFT The window has generic left-aligned properties. This is the default.

WS_EX_LEFTSCROLLBAR If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the vertical scroll bar (if present) is to the left of the client area. For other languages, the style is ignored.

WS_EX_LTRREADING The window text is displayed using left-to-right reading-order properties. This is the default.

WS_EX_MDICHILD The window is a MDI child window.

WS_EX_NOACTIVATE A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window. The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style.

WS_EX_NOINHERITLAYOUT The window does not pass its window layout to its child windows.

WS_EX_NOPARENTNOTIFY The child window created with this style does not send the WM_PARENTNOTIFY message to its parent window when it is created or destroyed.

WS_EX_NOREDIRECTIONBITMAP The window does not render to a redirection surface. This is for windows that do not have visible content or that use mechanisms other than surfaces to provide their visual.

WS_EX_OVERLAPPEDWINDOW The window is an overlapped window.

WS_EX_PALETTEWINDOW The window is palette window, which is a modeless dialog box that presents an array of commands.

WS_EX_RIGHT The window has generic "right-aligned" properties. This depends on the window class. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading-order alignment; otherwise, the style is ignored. Using the WS_EX_RIGHT style for static or edit controls has the same effect as using the SS_RIGHT or ES_RIGHT style, respectively. Using this style with button controls has the same effect as using BS_RIGHT and BS_RIGHTBUTTON styles.

WS_EX_RIGHTSCROLLBAR The vertical scroll bar (if present) is to the right of the client area. This is the default.

WS_EX_RTLREADING If the shell language is Hebrew, Arabic, or another language that supports reading-order alignment, the window text is displayed using right-to-left reading-order properties. For other languages, the style is ignored.

WS_EX_STATICEDGE The window has a three-dimensional border style intended to be used for items that do not accept user input.

WS_EX_TOOLWINDOW The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE.

WS_EX_TOPMOST The window should be placed above all non-topmost windows and should stay above them, even when the window is deactivated.

WS_EX_TRANSPARENT The window should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted.

WS_EX_WINDOWEDGE The window has a border with a raised edge.

 

Return Value

 

If the function succeeds, the return value is a handle to the new window.

If the function fails, the return value is false.

To get extended error information, call api_control_get_last_error().

 

Control Functions

 

api_window_set_show(WindowHandle, ShowState) Sets the specified window’s show state. If the window was previously visible, the return value is nonzero. If the window was previously hidden, the return value is zero.

WindowHandle: it must be a WindowHandle.
ShowState: controls how the window is to be shown.

ShowState can be one of the following values.

SW_FORCEMINIMIZE Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.

SW_HIDE Hides the window and activates another window.

SW_MAXIMIZE Maximizes the specified window.

SW_MINIMIZE Minimizes the specified window and activates the next top-level window in the Z order.

SW_RESTORE Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.

SW_SHOW Activates the window and displays it in its current size and position.

SW_SHOWDEFAULT Sets the show state based on the program that started the application.

SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.

SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.

SW_SHOWMINNOACTIVE Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.

SW_SHOWNA Displays the window in its current state. The active window remains active.

SW_SHOWNOACTIVATE Displays a window in its most recent size and position. The active window remains active.

SW_SHOWNORMAL Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.

 

api_window_set_icon(WindowHandle, IconHandle, BigOrSmall) Associates a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption.

WindowHandle: it must be a WindowHandle.
IconHandle: it must be an IconHandle.
BigOrSmall: icon type.

BigOrSmall can be one of the following flags:

ICON_BIG Set the large icon for the window.

ICON_SMALL Set the small icon for the window.

 

api_window_set_menu(WindowHandle, MenuHandle) Assigns a new menu to the specified window. If the function succeeds, the return value is true. If the function fails, the return value is false.

WindowHandle: it must be a WindowHandle.
MenuHandle: it must be a MenuHandle.

 

api_window_get_menu(WindowHandle) The return value is a handle to the menu. If the specified window has no menu, the return value is false. If the window is a child window, the return value is undefined.

WindowHandle: it must be a WindowHandle.

 

api_window_get_minimized(WindowHandle) The function returns true when the given window is minimized or false otherwise.

WindowHandle: it must be a WindowHandle.

 

api_window_get_maximized(WindowHandle) The function returns true when the given window is maximized or false otherwise.

WindowHandle: it must be a WindowHandle.

 

api_window_get_closed(WindowHandle) The function returns true when the user clicked on the X (close button) or false otherwise.

PLEASE NOTE: you must call api_control_delete() to close the window.

WindowHandle: it must be a WindowHandle.

 

api_window_get_deleted(WindowHandle) The function returns true when the given window has been deleted or false otherwise.

WindowHandle: it must be a WindowHandle.

 

api_window_set_active(WindowHandle) Activates a window. The window must be attached to the calling thread’s message queue.

WindowHandle: it must be a WindowHandle.

 

api_window_get_active() This function returns the handle to the active window attached to the calling thread’s message queue or false otherwise.

 

api_window_get_activated(WindowHandle) This function returns whether the specified window is being activated (true) or not (false).

WindowHandle: it must be a WindowHandle.

 

api_window_set_foreground(WindowHandle) Brings the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user.

WindowHandle: it must be a WindowHandle.

 

api_window_get_foreground() Retrieves a handle to the foreground window (the window with which the user is currently working).

 

api_window_get_classname(WindowHandle) This function returns the class name of the given window or an empty string otherwise.

WindowHandle: it must be a WindowHandle.

 

api_window_get_gamemaker() This function returns a real (decimal) value of the GameMaker Window Handle. This Handle is compatible with all api_* functions.

PLEASE NOTE: Do not use window_handle() or window_device() since these functions will return an hexadecimal value.

 

api_window_set_giavapps_procedure(Enabled) This function overwrites the GameMaker Window Procedure with the Giavapps Window Procedure. If you call this function the GameMaker Window will behave exactly as all other Giavapps Windows. When you use this feature you must explicitly call game_end() function when you would like to terminate the application otherwise it will always run even when all windows have been deleted (you will need to terminate the process manually from the Task Manager in that case). This feature is particularly usefull when you want to assign the role of Main Window to a specific Giavapps Window or when you would like to perform some operations before closing the application.

PLEASE NOTE: you will lose some built-in functionalities related to GameMaker Window Procedure when you enable this feature.

Enabled: enables (true) or disables (false) the Giavapps Window Procedure for the GameMaker Window.

 

api_window_get_giavapps_procedure() This function returns true if the Giavapps Window Procedure is enabled for the GameMaker Window or false otherwise.

 

Code Examples

 

Creating a Window

 

window = api_window_create(0,10,10,200,200,WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,0);

 

Assigning a Control to a Window

 

button = api_button_create(window,10,10,100,32,WS_VISIBLE,0);

 

Checking if a Window Has Been Closed

 

Step Event:

 

if(api_window_get_closed(window))
{
api_control_delete(window);//closes the specified window
}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*