ListBoxEx Plugin Help

WinApi Plugin

Welcome

WinApi Action Plugin Help File

Plugin Name :

WinApi

Current Version :

2.2.0.0

Last Update :

05/04/2010 (dd/mm/yyyy)

System Requirements :

Requires WindowsXP (SP2) Or Above

Additional Dependencies :

none

Licence :

Freeware

IMPORTANT NOTE :

1) There Is A File Named "WinApiConstatns.lua" In Main Plugin Package. Copy
The Contents Of The File And Paste Them Into Your Project's Global
Actions Pane. This Is Neccessary Anytime You Use A Function, As A
Function Needs Constants.

2) You Are Responsible For Your Use of This Plugin

3) This Plugin May Require Some WinApi Knowledge Due To The Fact That
Most Of The Functions Utilized By The Plugin Use WinApi Calls

Author :

www.amsplugins.com

Web :

www.amsplugins.com

E-mail :

support@amsplugins.com

Copyright :

The WinApi plugin is copyright © 2008 - 2010 www.amsplugins.com

Copyright © 2008 - 2010 www.amsplugins.com
All Rights Reserved.


Function Name | Description
WinApi.FindWindow | function retrieves the handle to the top-level window whose window name match the specified strings. This function does not search child windows
WinApi.FlashWindow | flashes the specified window once.
WinApi.SetWindowIcon | Sets A New Icon For Specified Window.
WinApi.EnableWindow | function enables or disables mouse and keyboard input to the specified window or control.
WinApi.IsWindowEnabled | function determines whether the specified window is enabled for mouse and keyboard input.
WinApi.IsWindow | function determines whether the specified window handle identifies an existing window.
WinApi.SetWindowText | function changes the text of the specified window's title bar (if it has one).
WinApi.GetActiveWindow | function retrieves the handle of the active window.
WinApi.SetForegroundWindow | function puts the thread that created the specified window into the foreground and activates the window.
WinApi.GetForegroundWindow | function returns the handle of the foreground window (the window with which the user is currently working).
WinApi.WindowFromPoint | function retrieves the handle of the window that contains the specified point.
WinApi.IsWindowMaximized | function determines whether a window is maximized.
WinApi.IsWindowMinimized | function determines whether a window is minimized.
WinApi.GetWindowText | Returns the text of the specified window's title bar.
WinApi.GetWindowRect | function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
WinApi.SetWindowTrans | Sets Transparency Of Specified Window.
WinApi.MinimizeAllWindows | function minimizes all top level windows to taskbar and shows desktop.
WinApi.GetTopWindow | function examines the Z order of the child windows associated with the specified parent window and retrieves the handle of the child window at the top of the Z order.
WinApi.GetWindow | function retrieves the handle of a window that has the specified relationship (Z order or owner) to the specified window.
WinApi.FindWindowEx | function retrieves the handle to a window whose class name and window name match the specified strings.
WinApi.ChildWindowFromPoint | function determines which, if any, of the child windows belonging to a parent window contains the specified point.
WinApi.ChildWindowFromPointEx | function determines which, if any, of the child windows belonging to the specified parent window contains the specified point. The function can ignore invisible, disabled, and transparent child windows.
WinApi.GetParent | function retrieves the handle of the specified child window's parent window.
WinApi.SetParent | function changes the parent window of the specified child window.
WinApi.IsChildWindow | function tests whether a window is a child window or descendant window of a specified parent window.
WinApi.GetDesktopWindow | function returns the handle of the Windows desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which all icons and other windows are painted.
WinApi.SetActiveWindow | function activates a window.
WinApi.IsWindowVisible | function retrieves the visibility state of the specified window.
WinApi.GetClientRect | function retrieves the coordinates of a window's client area.
WinApi.ShowWindow | function sets the specified window's show state.
WinApi.CreateWindowEx | function creates an overlapped, pop-up, or child window.
WinApi.GetLastActivePopup | function determines which pop-up window owned by the specified window was most recently active.
WinApi.MoveWindow | function changes the position and dimensions of the specified window.
WinApi.SetWindowLong | function changes an attribute of the specified window.
WinApi.GetWindowLong | function retrieves information about the specified window.
WinApi.AnimateWindow | function animates specified window
WinApi.CreatePopupWindow | function creates an overlapped, pop-up, or child window.
WinApi.SetWindowCursor | Sets A New Cursor For Specified Window.
WinApi.CreateIEHolder | function creates an Internet Explorer Object.
WinApi.StrokeAndFillPath | function closes any open figures in a path.
WinApi.ReleaseDC | function releases a device context (DC), freeing it for use by other applications.
WinApi.EndPath | function closes a path bracket and selects the path defined by the bracket into the specified device context.
WinApi.LineTo | function draws a line from the current position up to, but not including, the specified point.
WinApi.AngleArc | function draws a line segment and an arc.
WinApi.GetDC | function retrieves a handle of a display device context (DC) for the client area of the specified window.
WinApi.GetWindowDC | function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars
WinApi.BeginPath | function opens a path bracket in the specified device context.
WinApi.SelectObject | function selects an object into the specified device context.
WinApi.GetStockObject | function retrieves a handle to one of the predefined stock pens, brushes, fonts, or palettes.
WinApi.MoveToEx | function updates the current position to the specified point
WinApi.CreateSolidBrush | function creates a logical brush that has the specified solid color.
WinApi.Rectangle | function draws a rectangle.
WinApi.CreatePen | function creates a logical pen that has the specified style, width, and color.
WinApi.RoundRect | function draws a rectangle with rounded corners.
WinApi.Ellipse | function draws an ellipse.
WinApi.DeleteObject | function deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object.
WinApi.BlockInput | function blocks keyboard and mouse input events from reaching applications.
WinApi.MciSendString | function sends a MCI command string and returns a value if necessary.
WinApi.MouseMove | function moves the cursor to the specified screen coordinates.
WinApi.MouseClick | function performs a mouse click operation ONES
WinApi.SetBkMode | function sets the background mix mode of the specified device context.
WinApi.SetBkColor | function sets the current background color to the specified color value, or to the nearest physical color if the device cannot represent the specified color value
WinApi.GetPixel | function retrieves the Decimal color value of the pixel at the specified coordinates.
WinApi.SetPixel | function draws a Pie Chart.
WinApi.GetLocaleInfo | function retrieves information about a locale
WinApi.CaptureWindow | Takes A ScreenShot From Specified Window.
WinApi.EnumDisplaySettings | function enumerates available display settings
WinApi.SetDisplaySettings | function changes the settings of the default display device to the specified graphics mode.
WinApi.GetCurrDisplaySettings | function returns current display settings
WinApi.ChooseColor | function opens standart system ChooseColor dialog and returns a table
WinApi.ChooseFont | function opens standart system ChooseFont dialog and returns a table
WinApi.GetTickCount | function retrieves the number of milliseconds that have elapsed since Windows was started.
WinApi.RecycleBinGetInfo | function returns total size and Items of the system recycle bin.
WinApi.DelimitedStringToTable | function converts a delimited string to a Lua table.
WinApi.MakeShadow | function applies Windows Xp shadow effect to specified window
WinApi.RecycleBinEmpty | function empties the recycle bin
WinApi.SetCaptionButtons | function enables or disables caption buttons of a specified window.
WinApi.RecycleBinPutFile | function moves a file to recycle bin
WinApi.OpenFilePropertiesDlg | function opens system default file properties dialog for a specified file
WinApi.DecToHexColor | function converts a Decimal color value to Hex color value EX:(255 to "FF0000")
WinApi.RGBToHexColor | function converts a RGB color value to Hex color value EX:((255,0,0) to "FF0000")
WinApi.DecToRGBColor | function converts a Decimal color value to RGB color value EX:(0 to (0,0,0)
WinApi.PlaySound | function plays a WAV file at a time(this function can play only WAV format)
WinApi.HtmlHelp | function opens Html help file (chm) with specified topic.
WinApi.IntToStr | function converts a number to string
WinApi.Int | function converts a (float) floating point value to (int) number
WinApi.CreateFont | function creates a logical font with the specified characteristics.
WinApi.TextOut | function writes a character string at the specified location, using the currently selected font, background color, and text color.
WinApi.SetTextColor | function sets the text color for the specified device context to the specified color
WinApi.SetDisplaySettingsQ | function changes the settings of the default display device to the specified graphics mode.
WinApi.FillRect | function fills a rectangle by using the specified brush
WinApi.GetFolderSize | function returns size of a specified folder(in bytes)
WinApi.RecycleBinEnumerate | function enumerates files/folders that are stored by the recyclebin
WinApi.RecycleBinRestore | function restores an item to its original location.
WinApi.RecycleBinDelete | function deletes an item from recyclebin.
WinApi.EnumerateFonts | function enumerates avilable fonts on the system.
WinApi.ClipBoardPutText | Copies text to the Windows clipboard.
WinApi.ClipBoardGetText | Retrieves text from the Windows clipboard.
WinApi.ClipBoardIsEmpty | Determines whether text is available on the Windows clipboard.
WinApi.GetTaskBar | function retrieves the dimensions and status of task bar
WinApi.GetSysColor | Retrieves text from the Windows clipboard.
WinApi.ImageGetSize | function retrieves the width and height of an image.
WinApi.ImageConvertTo | Copies text to the Windows clipboard.
WinApi.ImageIsValid | function determines whether specified file is a valid image.


Untitled Document

The WinApi.WindowFromPoint function retrieves the handle of the window that contains the specified point.

number WinApi.WindowFromPoint(

number XCoord --X Coordinate Of The Point
number YCoord --Y Coordinate Of The Point.
);

Parameters

XCoord

Specifies X Coordinate Of The Point

YCoord

Specifies Y Coordinate Of The Point

Return Values

If the function succeeds, the return value is the handle of the window that contains the point. If no window exists at the given point, the return value is 0.

Remarks

The WinApi.WindowFromPoint function does not retrieve the handle of a hidden or disabled window, even if the point is within the window. An application should use the WinApi.ChildWindowFromPoint function for a nonrestrictive search.


Untitled Document

The WinApi.ShowWindow function sets the specified window's show state.

boolean WinApi.ShowWindow(

number hWnd, --handle of window
string nCmdShow --show state of window
);

Parameters

hWnd

Identifies the window.

nCmdShow

Specifies how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values:

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, Windows 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 SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by 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. The active window remains active.

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, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.

Return Values

If the window was previously visible, the return value is TRUE.
If the window was previously hidden, the return value is FALSE.

Remarks

The first time a program calls ShowWindow, it uses the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter.
As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to ShowWindow if the program that launched the application specifies startup information in the STARTUPINFO structure. In this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window. On subsequent calls, the application must call ShowWindow with nCmdShow set to SW_SHOWDEFAULT to use the startup information provided by the program that launched the application. For example, Program Manager specifies that applications start with a minimized main window. This behavior is designed for the following situations:

· Applications create their main window by calling CreateWindow with the WS_VISIBLE flag set.
· Applications create their main window by calling CreateWindow with the WS_VISIBLE flag cleared, and later call ShowWindow with the SW_SHOW flag set to make it visible.


Untitled Document

The WinApi.SetWindowTrans function Sets Transparency Of Specified Window.

WinApi.SetwindowTrans(

number hWnd, --Identifies the target window
number Alpha --Specifies the Alpha Value
);

Parameters

hWnd

Identifies the target window to set transparency

Alpha

Specifies the Alpha Value Of Transparency (min: 1 to max: 255) .

Return Values

this function has no return value


Untitled Document

The WinApi.SetWindowText function changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of the control is changed.

boolean WinApi.SetWindowText(

number hWnd, --handle of window or control
string lpString --address of string
);

Parameters

hWnd

Identifies the window or control whose text is to be changed.

lpString

string to be used as the new title or control text.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.SetWindowLong function changes an attribute of the specified window.

*** = Not Available At This Time

number WinApi.SetWindowLong(

number hWnd, -- handle of window
string nIndex, --offset of value to set
string dwNewLong --new value
);

Parameters

hWnd

Identifies the window and, indirectly, the class to which the window belongs.

nIndex

Specifies the offset to the value to be set. specify one of the following values:

GWL_EXSTYLE Sets a new extended window style.

GWL_STYLE Sets a new window style.

GWL_WNDPROC Sets a new address for the window procedure.***

GWL_HINSTANCE Sets a new application instance handle.***

GWL_ID Sets a new identifier of the window.

GWL_USERDATA Sets the 32-bit value associated with the window. Each window has a corresponding 32-bit value intended for use by the application that created the window. ***

dwNewLong

Specifies the replacement value.

Example 1: When Setting Window Style

WS_POPUP.."|"..WS_BORDER.."|"..WS_SYSMENU

Example 2: When Setting Window ExStyle

WS_EX_WINDOWEDGE.."|"..WS_EX_TOOLWINDOW.."|"..WS_EX_TOPMOST

Example 2: When Setting A New ID

"44557"

Return Values

If the function succeeds, the return value is the previous value of the Window long.
If the function fails, the return value is 0.


Untitled Document

The WinApi.SetWindowIcon function changes icon of the specified window

boolean WinApi.SetWindowIcon(

number hWnd, --handle to window
string IcoFile --icon file with FULL path
);

Parameters

hWnd

Identifies the window to change icon.

IcoFile

Specifies the icon file, this can be standart Windows icon file and can be 16x16 - 32x32 - 48x48
filepath must be FULL ex:. "AutoPlay\\Icons\\MyIcon.ico" or "C:\\MyIcon.ico"

Return Values

If the function succeeds, the return value is TRUE
If an error occured, the return value is FALSE

This function returns FALSE (error) only if specified window not exist , TRUE otherwise
Be careful with icon type and file path these must be correct.

Note For Beginers: this function changes icon at runtime only , not patch to exe

There is no undo action of this function YOU CAN NOT ROLL BACK OLD ICON AFTER CHANGED NEW ONE but you can add old icon with this function externally.


Untitled Document

The WinApi.SetWindowCursor function Sets A New Cursor For Specified Window

boolean WinApi.SetWindowCursor(

number hWnd, --handle to window
string CurFile --cursor file with FULL path
);

Parameters

hWnd

Identifies the window to change cursor.

CurFile

Specifies the cursor file,
filepath must be FULL ex:. "AutoPlay\\Icons\\MyCur.cur" or "C:\\MyCur.cur"

Return Values

If the function succeeds, the return value is TRUE
If an error occured, the return value is FALSE

This function returns FALSE (error) only if specified window not exist , TRUE otherwise

Remarks

To restore system default just call WinApi.SetWindowCursor(hwnd,"");


Untitled Document

The WinApi.SetParent function changes the parent window of the specified child window.

number WinApi.SetParent(

number hWndChild, --handle of window whose parent is changing
number hWndNewParent --handle of new parent window
);

Parameters

hWndChild

Identifies the child window.

hWndNewParent

Identifies the new parent window. If this parameter is 0, the desktop window becomes the new parent window.

Return Values

If the function succeeds, the return value is the handle of the previous parent window.
If the function fails, the return value is 0.

Remarks

An application can use the WinApi.SetParent function to set the parent window of a pop-up, overlapped, or child window. The new parent window and the child window must belong to the same application.

If the window identified by the hWndChild parameter is visible, Windows performs the appropriate redrawing and repainting


Untitled Document

The WinApi.SetForegroundWindow function puts 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.

boolean WinApi.SetForegroundWindow(

number hWnd --handle of window to bring to foreground
);

Parameters

hWnd

Identifies the window that should be activated and brought to the foreground.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

The foreground window is the window at the top of the Z order. It is the window that the user is working with. In a preemptive multitasking environment, you should generally let the user control which window is the foreground window. However, an application can call WinApi.SetForegroundWindow if it wants to put itself into the foreground to display a critical error or information that requires the user's immediate attention. A good example is a debugger when it hits a breakpoint.

The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.


Untitled Document

The WinApi.SetCaptionButtons function enables or disables caption buttons of a specified window.

WinApi.SetCaptionButtons(
number hWnd, --handle of window
string Btn, --caption button
boolean Enabled --enable
);

Parameters

hWnd

handle of window

Btn

specifies the caption button to be enabled or disabled

this parameter can be one of following "Close" "Minimize" "Maximize"

Enabled

specifies the caption button enabled status (true = enable) ( false = disable)

Return Values

this function has no return value


Untitled Document

The WinApi.SetActiveWindow function activates a window.

number WinApi.SetActiveWindow(

number hWnd --handle of window to activate
);

Parameters

hWnd

Identifies the top-level window to be activated.

Return Values

If the function succeeds, the return value is the handle of the window that was previously active.

Remarks

The WinApi.SetActiveWindow function activates a window, but not if the application is in the background. The window will be brought into the foreground (top of Z order) if the application is in the foreground when it sets the activation.


Untitled Document

The WinApi.MoveWindow function changes the position and dimensions of the specified window. For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent window's client area.

boolean WinApi.MoveWindow(

number hWnd, --handle of window
number X, --horizontal position
number Y, --vertical position
number nWidth, --width
number nHeight, --height
boolean bRepaint --repaint flag
);

Parameters

hWnd

Identifies the window.

X

Specifies the new position of the left side of the window.

Y

Specifies the new position of the top of the window.

nWidth

Specifies the new width of the window.

nHeight

Specifies the new height of the window.

bRepaint

Specifies whether the window is to be repainted. If this parameter is TRUE, the window receives a WM_PAINT message. If the parameter is FALSE, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of moving a child window. If this parameter is FALSE, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

If the bRepaint parameter is TRUE, Windows sends the WM_PAINT message to the window procedure immediately after moving the window (that is, the MoveWindow function calls the UpdateWindow function). If bRepaint is FALSE, Windows places the WM_PAINT message in the message queue associated with the window. The message loop dispatches the WM_PAINT message only after dispatching all other messages in the queue.


Untitled Document

The WinApi.MinimizeAllWindows function minimizes all top level windows to taskbar and shows desktop.

WinApi.MinimizeAllWindows();

Parameters

this function has no parameters

Return Values

this function has no return value


Untitled Document

The WinApi.MakeShadow function applies Windows Xp shadow effect to specified window.

boolean WinApi.MakeShadow(

number hWnd --handle of window
);

Parameters

hWnd

Identifies the top-level window to be shadow applied.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

Not Working Under Windows Xp


Untitled Document

The WinApi.IsWindowVisible function retrieves the visibility state of the specified window.

boolean WinApi.IsWindowVisible(

number hWnd --handle of window
);

Parameters

hWnd

Identifies the window.

Return Values

If the specified window and its parent window have the WS_VISIBLE style, the return value is TRUE.
If the specified window and its parent window do not have the WS_VISIBLE style, the return value is FALSE. Because the return value specifies whether the window has the WS_VISIBLE style, it may be TRUE even if the window is totally obscured by other windows.

Remarks

The visibility state of a window is indicated by the WS_VISIBLE style bit. When WS_VISIBLE is set, the window is displayed and subsequent drawing into it is displayed as long as the window has the WS_VISIBLE style.
Any drawing to a window with the WS_VISIBLE style will not be displayed if the window is obscured by other windows or is clipped by its parent window.


Untitled Document

The WinApi.IsWindowMinimized function determines whether the specified window is minimized (iconic).

boolean WinApi.IsWindowMinimized(

number hWnd --handle of window
);

Parameters

hWnd

Identifies the window.

Return Values

If the window is minimized, the return value is TRUE.
If the window is not minimized, the return value is FALSE.


Untitled Document

The WinApi.IsWindowMaximized function determines whether a window is maximized.

boolean WinApi.IsWindowMaximized(

number hWnd --handle of window
);

Parameters

hWnd

Identifies the window.

Return Values

If the window is maximized, the return value is TRUE.
If the window is not maximized, the return value is FALSE.


Untitled Document

The WinApi.IsWindowEnabled function determines whether the specified window is enabled for mouse and keyboard input.

boolean WinApi.IsWindowEnabled(

number hWnd -- handle of window to test
);

Parameters

hWnd

Identifies the window to test.

Return Values

If the window is enabled, the return value is TRUE.
If the window is not enabled, the return value is FALSE.

Remarks

A child window receives input only if it is both enabled and visible.


Untitled Document

The WinApi.IsWindow function determines whether the specified window handle identifies an existing window.

boolean WinApi.IsWindow(

number hWnd --handle of window
);

Parameters

hWnd

Specifies the window handle.

Return Values

If the window handle identifies an existing window, the return value is TRUE.
If the window handle does not identify an existing window, the return value is FALSE.


Untitled Document

The WinApi.IsChildWindow function tests whether a window is a child window or descendant window of a specified parent window. A child window is the direct descendant of a specified parent window if that parent window is in the chain of parent windows; the chain of parent windows leads from the original overlapped or pop-up window to the child window.

boolean WinApi.IsChildWindow(

number hWndParent, --handle of parent window
number hWnd --handle of window to test
);

Parameters

hWndParent

Identifies the parent window.

hWnd

Identifies the window to be tested.

Return Values

If the window is a child or descendant window of the specified parent window, the return value is TRUE.
If the window is not a child or descendant window of the specified parent window, the return value is FALSE.


Untitled Document

The WinApi.GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.

table WinApi.GetWindowRect(

number hWnd --handle of window
);

Parameters

hWnd

Identifies the window.

Return Values

If the function succeeds, the return value is table containing bounding rectangle of specified window

result = WinApi.GetWindowRect(Application.GetWndHandle());

left = result.Left;
top = result.Top;
right = result.Right;
bottom = result.bottom;

If the function fails, the return value is nil

if result ~= nil then
--do anything here
end


Untitled Document

The WinApi.GetWindowLong function retrieves information about the specified window.

number WinApi.GetWindowLong(

number hWnd, -- handle of window
string nIndex --offset of value to retrieve
);

*** = Can Return A Value But You Can Not Use It Anywhere

Parameters

hWnd

Identifies the window and, indirectly, the class to which the window belongs.

nIndex

Specifies the offset to the value to be retrieved. specify one of the following values:

GWL_EXSTYLE Retrieves the extended window styles.

GWL_STYLE Retrieves the window styles.

GWL_WNDPROC Retrieves the address of the window procedure, or a handle representing the address of the window procedure. ***

GWL_HINSTANCE Retrieves the handle of the application instance.***

GWL_HWNDPARENT Retrieves the handle of the parent window, if any.

GWL_ID Retrieves the identifier of the window.

GWL_USERDATA Retrieves the 32-bit value associated with the window. Each window has a corresponding 32-bit value intended for use by the application that created the window.***

Return Values

If the function succeeds, the return value is the requested value.
If the function fails, the return value is 0.


Untitled Document

The WinApi.GetWindow function retrieves the handle of a window that has the specified relationship (Z order or owner) to the specified window.

number WinApi.GetWindow(

number hWnd, --handle of original window
number uCmd --relationship flag
);

Parameters

hWnd

Identifies a window. The window handle retrieved is relative to this window, based on the value of the uCmd parameter.

uCmd

Specifies the relationship between the specified window and the window whose handle is to be retrieved. This parameter can be one of the following values:

GW_CHILD

The retrieved handle identifies the child window at the top of the Z order, if the specified window is a parent window; otherwise, the retrieved handle is 0. The function examines only child windows of the specified window. It does not examine descendant windows.

GW_HWNDFIRST

The retrieved handle identifies the window of the same type that is highest in the Z order. If the specified window is a topmost window, the handle identifies the topmost window that is highest in the Z order. If the specified window is a top-level window, the handle identifies the top-level window that is highest in the Z order. If the specified window is a child window, the handle identifies the sibling window that is highest in the Z order.

GW_HWNDLAST

The retrieved handle identifies the window of the same type that is lowest in the Z order. If the specified window is a topmost window, the handle identifies the topmost window that is lowest in the Z order. If the specified window is a top-level window, the handle identifies the top-level window that is lowest in the Z order. If the specified window is a child window, the handle identifies the sibling window that is lowest in the Z order.

GW_HWNDNEXT

The retrieved handle identifies the window below the specified window in the Z order. If the specified window is a topmost window, the handle identifies the topmost window below the specified window. If the specified window is a top-level window, the handle identifies the top-level window below the specified window. If the specified window is a child window, the handle identifies the sibling window below the specified window.

GW_HWNDPREV

The retrieved handle identifies the window above the specified window in the Z order. If the specified window is a topmost window, the handle identifies the topmost window above the specified window. If the specified window is a top-level window, the handle identifies the top-level window above the specified window. If the specified window is a child window, the handle identifies the sibling window above the specified window.

GW_OWNER

The retrieved handle identifies the specified window's owner window, if any.

Return Values

If the function succeeds, the return value is a window handle. If no window exists with the specified relationship to the specified window, the return value is 0.


Untitled Document

The WinApi.GetTopWindow function examines the Z order of the child windows associated with the specified parent window and retrieves the handle of the child window at the top of the Z order.

number WinApi.GetTopWindow(

number hWnd --handle of parent window
);

Parameters

hWnd

Identifies the parent window whose child windows are to be examined. If this parameter is 0, the function returns a handle of the window at the top of the Z order.

Return Values

If the function succeeds, the return value is the handle of the child window at the top of the Z order. If the specified window has no child windows, the return value is 0.


Untitled Document

The WinApi.GetParent function retrieves the handle of the specified child window's parent window.

number WinApi.GetParent(

number hWnd --handle of child window
);

Parameters

hWnd

Identifies the window whose parent window handle is to be retrieved.

Return Values

If the function succeeds, the return value is the handle of the parent window. If the window has no parent window, the return value is 0.


Untitled Document

The WinApi.GetLastActivePopup function determines which pop-up window owned by the specified window was most recently active.

number WinApi.GetLastActivePopup(

number hWnd --handle of owner window
);

Parameters

hWnd

Identifies the owner window.

Return Values

The return value identifies the most recently active pop-up window. The return value is the same as the hWnd parameter, if any of the following conditions are met:

· The window identified by hWnd was most recently active.
· The window identified by hWnd does not own any pop-up windows.
· The window identified by hWnd is not a top-level window or it is owned by another window.


Untitled Document

The WinApi.GetForegroundWindow function returns the handle of the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.

number WinApi.GetForegroundWindow();

Parameters

This function has no parameters.

Return Values

The return value is the handle of the foreground window.


Untitled Document

The WinApi.GetDesktopWindow function returns the handle of the Windows desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which all icons and other windows are painted.

number WinApi.GetDesktopWindow();

Parameters

This function has no parameters.

Return Values

The return value is the handle of the desktop window.


Untitled Document

The WinApi.GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).

table WinApi.GetClientRect(

number hWnd --handle of window
);

Parameters

hWnd

Identifies the window whose client coordinates are to be retrieved.

Return Values

If the function succeeds, the return value is table containing client coordinates of specified window
The Left and Top members are zero. The Right and Bottom members contain the width and height of the window.

result = WinApi.GetClientRect(Application.GetWndHandle());

left = result.Left;
top = result.Top;
right = result.Right;
bottom = result.bottom;

If the function fails, the return value is nil

if result ~= nil then
--do anything here
end


Untitled Document

The WinApi.GetActiveWindow function retrieves the window handle to the active window associated with the thread that calls the function.

number WinApi.GetActiveWindow();

Parameters

This function has no parameters.

Return Values

If the function succeeds, the return value is the handle to the active window associated with the thread that calls the function. If the calling thread does not have an active window, the return value is 0.


Untitled Document

The WinApi.FlashWindow function flashes the specified window once.

boolean WinApi.FlashWindow(

number hWnd, --handle to window to flash
boolean bInvert --flash status
);

Parameters

hWnd

Identifies the window to be flashed. The window can be either open or minimized (iconic).

bInvert

Specifies whether the window is to be flashed or returned to its original state. The window is flashed from one state to the other if this parameter is TRUE. If it is FALSE, the window is returned to its original state (either active or inactive). When an application is iconic, if this parameter is TRUE, the taskbar window button flashes active/inactive. If it is FALSE, the taskbar window button flashes inactive, meaning that it does not change colors. It flashes, as if it were being redraw, but it does not provide the visual invert clue to the user.

Return Values

The return value specifies the window's state before the call to the WinApi.FlashWindow function. If the window was active before the call, the return value is TRUE.
If the window was not active before the call, the return value is FALSE.

Remarks

Flashing a window means changing the appearance of its caption bar as if the window were changing from inactive to active status, or vice versa. (An inactive caption bar changes to an active caption bar; an active caption bar changes to an inactive caption bar.)
Typically, a window is flashed to inform the user that the window requires attention but that it does not currently have the keyboard focus.

The FlashWindow function flashes the window only once; for repeated flashing, the application should create a system timer.


Untitled Document

The WinApi.FindWindowEx .function retrieves the handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the given child window.

number WinApi.FindWindowEx(

number hwndParent, // handle to parent window
number hwndChildAfter, // handle to a child window
string lpszClass, // pointer to class name
string lpszWindow // pointer to window name
);

Parameters

hwndParent

Identifies the parent window whose child windows are to be searched.
If hwndParent is 0, the function uses the desktop window as the parent window. The function searches among windows that are child windows of the desktop.

hwndChildAfter

Identifies a child window. The search begins with the next child window in the Z order. hwndChildAfter must be a direct child window of hwndParent, not just a descendant window.
If hwndChildAfter is 0, the search begins with the first child window of hwndParent.
Note that if both hwndParent and hwndChildAfter are 0, the function searches all top-level windows.

lpszClass

Identifies the ClassName of target window , Set "" If Not Needed

lpszWindow

Identifies the Title of target window , Set "" If Not Needed. If this parameter is "", all window names match.

Return Values

If the function succeeds, the return value is the handle to the window that has the specified class and window names.
If the function fails, the return value is 0.


Untitled Document

The FindWindow function retrieves the handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows.

number FindWindow(

string lpClassName, --class name of window
string lpWindowName --name of window
);

Parameters

lpClassName

Class name of the window to find set "" if not needed

lpWindowName

specifies the window name (the window's title). If this parameter is "" all window names match.

Return Values

If the function succeeds, the return value is the handle to the window that has the specified class name and window name.
If the function fails, the return value is 0.


Untitled Document

The WinApi.EnableWindow function enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. When input is enabled, the window receives all input.

boolean WinApi.EnableWindow(

number hWnd, --handle to window
boolean bEnable --flag for enabling or disabling input
);

Parameters

hWnd

Identifies the window to be enabled or disabled.

bEnable

Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.

Return Values

If the function succeeds, the return value is TRUE
If an error occured, the return value is FALSE


Untitled Document

The WinApi.CreatePopupWindow function creates an overlapped, pop-up, window title, window style, and (optionally) the initial position and size of the window. The function also specifies the window's parent or owner, if any, and the window's menu.

number WinApi.CreatePopupWindow(

string dwExStyle, --extended window style
string lpWindowName, --window name
string dwStyle, --window style
number x, --horizontal position of window
number y, --vertical position of window
number nWidth, --window width
number nHeight, --window height
number hWndParent, --handle to parent or owner window
number hMenu, --handle to menu or child-window identifier
);

Parameters

dwExStyle

Specifies the extended style of the window. This parameter can be one of the following values:

WS_EX_ACCEPTFILES

Specifies that a window created with this style accepts drag-drop files

WS_EX_APPWINDOW

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

WS_EX_CLIENTEDGE

Specifies that a window has a border with a sunken edge.

WS_EX_CONTEXTHELP

Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window.WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.

WS_EX_CONTROLPARENT

Allows the user to navigate among the child windows of the window by using the TAB key.

WS_EX_DLGMODALFRAME

Creates a window that has a double border; the window can, optionally, be created with a title bar by specifying theWS_CAPTION style in the dwStyle parameter.

WS_EX_LEFT

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 and not treated as an error.

WS_EX_LTRREADING

The window text is displayed using Left to Right reading-order properties. This is the default.

WS_EX_MDICHILD

Creates an MDI child window.

WS_EX_NOPARENTNOTIFY

Specifies that a 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_OVERLAPPEDWINDOW

Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles.

WS_EX_PALETTEWINDOW

Combines the WS_EX_WINDOWEDGE, WS_EX_TOOLWINDOW, and WS_EX_TOPMOST styles.

WS_EX_RIGHT

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 and not treated as an error.

WS_EX_RIGHTSCROLLBAR

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 and not treated as an error.

WS_EX_STATICEDGE

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

WS_EX_TOOLWINDOW

Creates a tool window; that is, a window 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.

WS_EX_TOPMOST

Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function

.
WS_EX_TRANSPARENT

Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.

WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.

lpWindowName

specifies the window name.

dwStyle

Specifies the style of the window being created. This parameter can be a combination of the window styles and control styles listed in the following Remarks section.

For Example : WS_CHILD.."|"..WS_VISIBLE.."|"..BS_PUSHBUTTON.."|"..BS_TEXT"

x

Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area.

y

Specifies the initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box, y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area.

If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, Windows ignores the y parameter.

nWidth

Specifies the width, in device units, of the window. For overlapped windows, nWidth is either the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, Windows selects a default width and height for the window; the default width extends from the initial x-coordinate to the right edge of the screen, and the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, nWidth and nHeight are set to zero.

nHeight

Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If nWidth is set to CW_USEDEFAULT, Windows ignores nHeight.

hWndParent

Identifies the parent or owner window of the window being created. A valid window handle must be supplied when a child window or an owned window is created. A child window is confined to the client area of its parent window. An owned window is an overlapped window that is destroyed when its owner window is destroyed or hidden when its owner is minimized; it is always displayed on top of its owner window. Although this parameter must specify a valid handle if the dwStyle parameter includes the WS_CHILD style, it is optional if dwStyle includes the WS_POPUP style.

hMenu

Identifies a menu, or specifies a child-window identifier depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be 0 if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.

Return Values

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

Remarks

The following window styles can be specified in the dwStyle parameter:

WS_BORDER Creates a window that has a thin-line border.

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

WS_CHILD Creates a child window. 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 Creates a window that is initially disabled. A disabled window cannot receive input from the user.

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

WS_GROUP Specifies 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 Creates a window that has a horizontal scroll bar.

WS_ICONIC Creates a window that is initially minimized. Same as the WS_MINIMIZE style.

WS_MAXIMIZE Creates a window that is initially maximized.

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

WS_MINIMIZE Creates a window that is initially minimized. Same as the WS_ICONIC style.

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

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

WS_OVERLAPPEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style

.
WS_POPUP Creates a pop-up window. This style cannot be used with the WS_CHILD style.

WS_POPUPWINDOW Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.

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

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

WS_TABSTOP Specifies 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 Creates a window that has a sizing border. Same as the WS_SIZEBOX style.

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

WS_TILEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.

WS_VISIBLE Creates a window that is initially visible.

WS_VSCROLL Creates a window that has a vertical scroll bar.


Untitled Document

The WinApi.CreateIEHolder function creates an Internet Explorer Object on the specified window

number WinApi.CreateIEHolder(
string lpFilePath, --file path will be showed
string dwStyle, --window style
number x, --horizontal position of window
number y, --vertical position of window
number nWidth, --window width
number nHeight, --window height
number hWndParent, --handle to parent or owner window
);

Parameters

lpFilePath

Identifies the File path will be showed this path must be full (from drive letter to file extension)

dwStyle

Specifies the style of the window being created. This parameter can be a combination of the window styles listed in the following Remarks section.

For Example : WS_CHILD.."|"..WS_VISIBLE.."|"..BS_PUSHBUTTON.."|"..BS_TEXT"

x

Specifies the initial horizontal position of the window.

y

Specifies the initial vertical position of the window.

nWidth

Specifies the width, in device units, of the window.

nHeight

Specifies the height, in device units, of the window.

hWndParent

Identifies the parent or owner window of the window being created.

Return Values

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

Remarks

The following window styles can be specified in the dwStyle parameter:

WS_BORDER Creates a window that has a thin-line border.

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

WS_CHILD Creates a child window. 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 Creates a window that is initially disabled. A disabled window cannot receive input from the user.

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

WS_GROUP Specifies 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 Creates a window that has a horizontal scroll bar.

WS_ICONIC Creates a window that is initially minimized. Same as the WS_MINIMIZE style.

WS_MAXIMIZE Creates a window that is initially maximized.

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

WS_MINIMIZE Creates a window that is initially minimized. Same as the WS_ICONIC style.

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

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

WS_OVERLAPPEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style

.
WS_POPUP Creates a pop-up window. This style cannot be used with the WS_CHILD style.

WS_POPUPWINDOW Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.

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

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

WS_TABSTOP Specifies 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 Creates a window that has a sizing border. Same as the WS_SIZEBOX style.

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

WS_TILEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.

WS_VISIBLE Creates a window that is initially visible.

WS_VSCROLL Creates a window that has a vertical scroll bar.


Untitled Document

TheWinApi.ChildWindowFromPointEx function determines which, if any, of the child windows belonging to the specified parent window contains the specified point. The function can ignore invisible, disabled, and transparent child windows.

number WinApi.ChildWindowFromPointEx(

number hWnd, --handle to parent window
number XCoord, --X Coordinate Of The Point
number YCoord, --Y Coordinate Of The Point.
string uFlags --skipping flags
);

Parameters

hWnd

Specifies handle to parent window

XCoord

Specifies X Coordinate Of The Point

YCoord

Specifies Y Coordinate Of The Point

uFlags

Specifies which child windows to skip. This parameter can be a combination of the following values:
For Example : CWP_SKIPINVISIBLE .."|"..CWP_SKIPTRANSPARENT

CWP_ALL

Do not skip any child windows

CWP_SKIPINVISIBLE

Skip invisible child windows

CWP_SKIPDISABLED

Skip disabled child windows

CWP_SKIPTRANSPARENT

Skip transparent child windows

Return Values

If the function succeeds, the return value is the handle to the first child window that contains the point and meets the criteria specified by uFlags. If the point is within the parent window but not within any child window that meets the criteria, the return value is the handle to the parent window. If the point lies outside the parent window or if the function fails, the return value is 0.

Remarks

Windows maintains an internal list that contains the handles of the child windows associated with a parent window. The order of the handles in the list depends on the Z order of the child windows. If more than one child window contains the specified point, Windows returns the handle of the first window in the list that contains the point and meets the criteria specified by uFlags.


Untitled Document

TheWinApi.ChildWindowFromPoint function determines which, if any, of the child windows belonging to a parent window contains the specified point.

number WinApi.ChildWindowFromPoint(

number hWnd, --handle to parent window
number XCoord, --X Coordinate Of The Point
number YCoord --Y Coordinate Of The Point.
);

Parameters

hWnd

Specifies handle to parent window

XCoord

Specifies X Coordinate Of The Point

YCoord

Specifies Y Coordinate Of The Point

Return Values

If the function succeeds, the return value is the handle of the child window that contains the point, even if the child window is hidden or disabled. If the point lies outside the parent window, the return value is 0. If the point is within the parent window but not within any child window, the return value is the handle to the parent window.

Remarks

Windows maintains an internal list, containing the handles of the child windows associated with a parent window. The order of the handles in the list depends on the Z order of the child windows. If more than one child window contains the specified point, Windows returns the handle of the first window in the list that contains the point.


Untitled Document

The WinApi.CaptureWindow function Takes A ScreenShot From Specified Window.

boolean WinApi.CaptureWindow(

number hWnd --handle of window to capture
string bMp --bmp file path to be saved
);

Parameters

hWnd

Identifies the top-level window to be captured.

bMp

bmp file path to be saved, this function can save image only in BMP format

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.AnimateWindow function Animates specified window

boolean WinApi.AnimateWindow(

number hWnd, --handle of window to animate
number dUrarion, --Duration in Ms. (1000 ms = 1 second)
string aNiType, --Animation Type
);

Parameters

hWnd

handle of window to animate

dUrarion

Duration in Ms. (1000 ms = 1 second)

aNiType

Specifies the animation type. This parameter can be one or a combination of the animation types listed in the following section.

For Example :

AW_FADEIN

AW_FADEIN.."|"..AW_SLIDEIN_LEFT"

AW_FADEIN

fade-in

AW_FADEOUT

fade-out

AW_SLIDEIN_LEFT

slide in from left

AW_SLIDEOUT_LEFT

slide out to left

AW_SLIDEIN_RIGHT

slide in from right

AW_SLIDEOUT_RIGHT

slide out to right

AW_SLIDEIN_TOP

slide-in from top

AW_SLIDEOUT_TOP

slide-out to top

AW_SLIDEIN_BOTTOM

slide-in from bottom

AW_SLIDEOUT_BOTTOM

slide-out to bottom

AW_SLIDEIN_TOPLEFT

diagonal slide-in from Top-left

AW_SLIDEOUT_TOPLEFT

diagonal slide-out to Top-left

AW_SLIDEIN_TOPRIGHT

diagonal slide-in from Top-Right

AW_SLIDEOUT_TOPRIGHT

diagonal slide-out to Top-Right

AW_SLIDEIN_BOTTOMLEFT

diagonal slide-in from Bottom-left

AW_SLIDEOUT_BOTTOMLEFT

diagonal slide-out to Bottom-left

AW_SLIDEIN_BOTTOMRIGHT

diagonal slide-in from Bottom-right

AW_SLIDEOUT_BOTTOMRIGHT

diagonal slide-out to Bottom-right

AW_EXPLODE

explode

AW_IMPLODE

implode

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

Not Working under Windows Xp


Untitled Document

The WinApi.GetWindowText function Returns the text of the specified window's title bar.

string WinApi.GetWindowText(

number hWnd, --handle of window or control with text
number nMaxCount --max caption size
);

Parameters

hWnd

Identifies the window or control containing the text.

nMaxCount

Specifies the maximum number of characters to return. If the text exceeds this limit, it is truncated.

Return Values

If the function succeeds, the return value is title of specified window

if function fails return value is nil

Remarks

This function cannot retrieve the text of an edit control in another application.


Untitled Document

The WinApi.CreateWindowEx function creates an overlapped, pop-up, or child window. It specifies the window class, window title, window style, and (optionally) the initial position and size of the window. The function also specifies the window's parent or owner, if any, and the window's menu.

number WinApi.CreateWindowEx(

string dwExStyle, --extended window style
string lpClassName, --registered class name
string lpWindowName, --window name
string dwStyle, --window style
number x, --horizontal position of window
number y, --vertical position of window
number nWidth, --window width
number nHeight, --window height
number hWndParent, --handle to parent or owner window
number hMenu, --handle to menu or child-window identifier
number hInstance, --NOT AVAILABLE NOW ( FOR FUTURE VERSIONS) LEAVE 0(zero)
number lpParam --NOT AVAILABLE NOW ( FOR FUTURE VERSIONS) LEAVE 0(zero)
);

Parameters

dwExStyle

Specifies the extended style of the window. This parameter can be one of the following values:

WS_EX_ACCEPTFILES

Specifies that a window created with this style accepts drag-drop files

WS_EX_APPWINDOW

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

WS_EX_CLIENTEDGE

Specifies that a window has a border with a sunken edge.

WS_EX_CONTEXTHELP

Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window.WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.

WS_EX_CONTROLPARENT

Allows the user to navigate among the child windows of the window by using the TAB key.

WS_EX_DLGMODALFRAME

Creates a window that has a double border; the window can, optionally, be created with a title bar by specifying theWS_CAPTION style in the dwStyle parameter.

WS_EX_LEFT

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 and not treated as an error.

WS_EX_LTRREADING

The window text is displayed using Left to Right reading-order properties. This is the default.

WS_EX_MDICHILD

Creates an MDI child window.

WS_EX_NOPARENTNOTIFY

Specifies that a 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_OVERLAPPEDWINDOW

Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles.

WS_EX_PALETTEWINDOW

Combines the WS_EX_WINDOWEDGE, WS_EX_TOOLWINDOW, and WS_EX_TOPMOST styles.

WS_EX_RIGHT

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 and not treated as an error.

WS_EX_RIGHTSCROLLBAR

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 and not treated as an error.

WS_EX_STATICEDGE

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

WS_EX_TOOLWINDOW

Creates a tool window; that is, a window 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.

WS_EX_TOPMOST

Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function

.
WS_EX_TRANSPARENT

Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.

WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.

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

lpClassName

You Can not Use An Atom As Class Name
If lpClassName is a string, it specifies the window class name. The class name can be any name registered with the RegisterClass function or any of the predefined control-class names. For a complete list, see the following Remarks section.

lpWindowName

specifies the window name.

dwStyle

Specifies the style of the window being created. This parameter can be a combination of the window styles and control styles listed in the following Remarks section.

For Example : WS_CHILD.."|"..WS_VISIBLE.."|"..BS_PUSHBUTTON.."|"..BS_TEXT"

x

Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area.

y

Specifies the initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box, y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area.

If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, Windows ignores the y parameter.

nWidth

Specifies the width, in device units, of the window. For overlapped windows, nWidth is either the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, Windows selects a default width and height for the window; the default width extends from the initial x-coordinate to the right edge of the screen, and the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, nWidth and nHeight are set to zero.

nHeight

Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If nWidth is set to CW_USEDEFAULT, Windows ignores nHeight.

hWndParent

Identifies the parent or owner window of the window being created. A valid window handle must be supplied when a child window or an owned window is created. A child window is confined to the client area of its parent window. An owned window is an overlapped window that is destroyed when its owner window is destroyed or hidden when its owner is minimized; it is always displayed on top of its owner window. Although this parameter must specify a valid handle if the dwStyle parameter includes the WS_CHILD style, it is optional if dwStyle includes the WS_POPUP style.

hMenu

Identifies a menu, or specifies a child-window identifier depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be 0 if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.

hInstance

NOT AVAILABLE NOW ( FOR FUTURE VERSIONS) LEAVE 0(zero)

lpParam

NOT AVAILABLE NOW ( FOR FUTURE VERSIONS) LEAVE 0(zero)

Return Values

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

Remarks

Before returning, CreateWindowEx sends a WM_CREATE message to the window procedure.
For overlapped, pop-up, and child windows, CreateWindowEx sends WM_CREATE, WM_GETMINMAXINFO, and WM_NCCREATE messages to the window. The lParam parameter of the WM_CREATE message contains a pointer to a CREATESTRUCT structure. If the WS_VISIBLE style is specified, CreateWindowEx sends the window all the messages required to activate and show the window.

If the window style specifies a title bar, the window title pointed to by lpWindowName is displayed in the title bar. When using CreateWindowEx to create controls, such as buttons, check boxes, and static controls, use lpWindowName to specify the text of the control.
If you specify Windows version 4.x when linking your application, its windows cannot have caption buttons unless they also have window menus. This is not a requirement for applications that you linked specifying Windows version 3.x.

The following predefined control classes can be specified in the lpClassName parameter:

BUTTON

Designates a small rectangular child window that represents a button the user can click to turn it on or off. Button controls can be used alone or in groups, and they can either be labeled or appear without text. Button controls typically change appearance when the user clicks them

.
COMBOBOX

Designates a control consisting of a list box and a selection field similar to an edit control. When using this style, an application should either display the list box at all times or enable a drop-down list box.
Depending on the style of the combo box, the user can or cannot edit the contents of the selection field. If the list box is visible, typing characters into the selection field highlights the first list box entry that matches the characters typed. Conversely, selecting an item in the list box displays the selected text in the selection field.

EDIT

Designates a rectangular child window into which the user can type text from the keyboard. The user selects the control and gives it the keyboard focus by clicking it or moving to it by pressing the TAB key. The user can type text when the edit control displays a flashing caret; use the mouse to move the cursor, select characters to be replaced, or position the cursor for inserting characters; or use the BACKSPACE key to delete characters.
Edit controls use the variable-pitch system font and display characters from the ANSI character set. The WM_SETFONT message can also be sent to the edit control to change the default font.
Edit controls expand tab characters into as many space characters as are required to move the caret to the next tab stop. Tab stops are assumed to be at every eighth character position.

LISTBOX

Designates a list of character strings. Specify this control whenever an application must present a list of names, such as filenames, from which the user can choose. The user can select a string by clicking it. A selected string is highlighted, and a notification message is passed to the parent window. Use a vertical or horizontal scroll bar with a list box to scroll lists that are too long for the control window. The list box automatically hides or shows the scroll bar, as needed.

MDICLIENT

Designates an MDI client window. This window receives messages that control the MDI application's child windows. The recommended style bits are WS_CLIPCHILDREN and WS_CHILD. Specify the WS_HSCROLL and WS_VSCROLL styles to create an MDI client window that allows the user to scroll MDI child windows into view.

SCROLLBAR

Designates a rectangle that contains a scroll box and has direction arrows at both ends. The scroll bar sends a notification message to its parent window whenever the user clicks the control. The parent window is responsible for updating the position of the scroll box, if necessary. Scroll bar controls have the same appearance and function as scroll bars used in ordinary windows. Unlike scroll bars, however, scroll bar controls can be positioned anywhere in a window for use whenever scrolling input is needed for a window.
The scroll bar class also includes size box controls. A size box is a small rectangle the user can expand to change the size of the window.

STATIC

Designates a simple text field, box, or rectangle used to label, box, or separate other controls. Static controls take no input and provide no output.

The following window styles can be specified in the dwStyle parameter:

WS_BORDER Creates a window that has a thin-line border.

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

WS_CHILD Creates a child window. 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 Creates a window that is initially disabled. A disabled window cannot receive input from the user.

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

WS_GROUP Specifies 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 Creates a window that has a horizontal scroll bar.

WS_ICONIC Creates a window that is initially minimized. Same as the WS_MINIMIZE style.

WS_MAXIMIZE Creates a window that is initially maximized.

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

WS_MINIMIZE Creates a window that is initially minimized. Same as the WS_ICONIC style.

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

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

WS_OVERLAPPEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style

.
WS_POPUP Creates a pop-up window. This style cannot be used with the WS_CHILD style.

WS_POPUPWINDOW Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.

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

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

WS_TABSTOP Specifies 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 Creates a window that has a sizing border. Same as the WS_SIZEBOX style.

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

WS_TILEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.

WS_VISIBLE Creates a window that is initially visible.

WS_VSCROLL Creates a window that has a vertical scroll bar.

The following button styles (in the BUTTON class) can be specified in the dwStyle parameter:

BS_3STATE Creates a button that is the same as a check box, except that the box can be grayed as well as checked or unchecked. Use the grayed state to show that the state of the check box is not determined.

BS_AUTO3STATE Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and unchecked.

BS_AUTOCHECKBOX Creates a button that is the same as a check box, except that the check state automatically toggles between checked and unchecked each time the user selects the check box.

BS_AUTORADIOBUTTON Creates a button that is the same as a radio button, except that when the user selects it, Windows automatically sets the button's check state to checked and automatically sets the check state for all other buttons in the same group to unchecked.

BS_CHECKBOX Creates a small, empty check box with text. By default, the text is displayed to the right of the check box. To display the text to the left of the check box, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style).

BS_DEFPUSHBUTTON Creates a push button that behaves like a BS_PUSHBUTTON style button, but also has a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.

BS_GROUPBOX Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper left corner.

BS_LEFTTEXT Places text on the left side of the radio button or check box when combined with a radio button or check box style. Same as the BS_RIGHTBUTTON style.

BS_OWNERDRAW Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created and a WM_DRAWITEM message when a visual aspect of the button has changed. Do not combine the BS_OWNERDRAW style with any other button styles.

BS_PUSHBUTTON Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.

BS_RADIOBUTTON Creates a small circle with text. By default, the text is displayed to the right of the circle. To display the text to the left of the circle, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style). Use radio buttons for groups of related, but mutually exclusive choices.
BS_USERBUTTON Obsolete, but provided for compatibility with 16-bit versions of Windows. Win32-based applications should use BS_OWNERDRAW instead.

BS_BITMAP Specifies that the button displays a bitmap.

BS_BOTTOM Places text at the bottom of the button rectangle.

BS_CENTER Centers text horizontally in the button rectangle.

BS_ICON Specifies that the button displays an icon.

BS_LEFT Left-justifies the text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is left justified on the right side of the check box or radio button.
BS_MULTILINE Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.

BS_NOTIFY Enables a button to send BN_DBLCLK, BN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style.

BS_PUSHLIKE Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked.

BS_RIGHT Right-justifies text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is right justified on the right side of the check box or radio button.

BS_RIGHTBUTTON Positions a radio button's circle or a check box's square on the right side of the button rectangle. Same as the BS_LEFTTEXT style.

BS_TEXT Specifies that the button displays text.

BS_TOP Places text at the top of the button rectangle.

BS_VCENTER Places text in the middle (vertically) of the button rectangle.

The following combo box styles (in the COMBOBOX class) can be specified in the dwStyle parameter:

CBS_AUTOHSCROLL Automatically scrolls the text in an edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.

CBS_DISABLENOSCROLL Shows a disabled vertical scroll bar in the list box when the box does not contain enough items to scroll. Without this style, the scroll bar is hidden when the list box does not contain enough items.

CBS_DROPDOWN Similar to CBS_SIMPLE, except that the list box is not displayed unless the user selects an icon next to the edit control.

CBS_DROPDOWNLIST Similar to CBS_DROPDOWN, except that the edit control is replaced by a static text item that displays the current selection in the list box.

CBS_HASSTRINGS Specifies that an owner-drawn combo box contains items consisting of strings. The combo box maintains the memory and address for the strings, so the application can use the CB_GETLBTEXT message to retrieve the text for a particular item.

CBS_LOWERCASE Converts to lowercase any uppercase characters entered into the edit control of a combo box.

CBS_NOINTEGRALHEIGHT Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, Windows sizes a combo box so that it does not display partial items.

CBS_OEMCONVERT Converts text entered in the combo box edit control. The text is converted from the Windows character set to the OEM character set and then back to the Windows set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the combo box to OEM characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN style.

CBS_OWNERDRAWFIXED Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are all the same height. The owner window receives a WM_MEASUREITEM message when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box has changed.

CBS_OWNERDRAWVARIABLE Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when you create the combo box; the owner window receives a WM_DRAWITEM message when a visual aspect of the combo box has changed.

CBS_SIMPLE Displays the list box at all times. The current selection in the list box is displayed in the edit control.
CBS_SORT Automatically sorts strings entered into the list box.

CBS_UPPERCASE Converts to uppercase any lowercase characters entered into the edit control of a combo box.

The following edit control styles (in the EDIT class) can be specified in the dwStyle parameter:

ES_AUTOHSCROLL Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position zero.

ES_AUTOVSCROLL Automatically scrolls text up one page when the user presses the ENTER key on the last line.
ES_CENTER Centers text in a multiline edit control.

ES_LEFT Left-aligns text.

ES_LOWERCASE Converts all characters to lowercase as they are typed into the edit control.

ES_MULTILINE Designates a multiline edit control. The default is single-line edit control.
When the multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default button. To use the ENTER key as a carriage return, use the ES_WANTRETURN style.
When the multiline edit control is not in a dialog box and the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If you do not specify ES_AUTOVSCROLL, the edit control shows as many lines as possible and beeps if the user presses the ENTER key when no more lines can be displayed.
If you specify the ES_AUTOHSCROLL style, the multiline edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press the ENTER key. If you do not specify ES_AUTOHSCROLL, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses the ENTER key. The window size determines the position of the word wrap. If the window size changes, the word wrapping position changes and the text is redisplayed.
Multiline edit controls can have scroll bars. An edit control with scroll bars processes its own scroll bar messages. Note that edit controls without scroll bars scroll as described in the previous paragraphs and process any scroll messages sent by the parent window.

ES_NOHIDESEL Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. If you specify ES_NOHIDESEL, the selected text is inverted, even if the control does not have the focus.

ES_NUMBER Allows only digits to be entered into the edit control.

ES_OEMCONVERT Converts text entered in the edit control. The text is converted from the Windows character set to the OEM character set and then back to the Windows set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.

ES_PASSWORD Displays an asterisk (*) for each character typed into the edit control. You can use the EM_SETPASSWORDCHAR message to change the character that is displayed.

ES_READONLY Prevents the user from typing or editing text in the edit control.

ES_RIGHT Right-aligns text in a multiline edit control.

ES_UPPERCASE Converts all characters to uppercase as they are typed into the edit control.

ES_WANTRETURN Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog box's default push button. This style has no effect on a single-line edit control.

The following list box control styles (in the LISTBOX class) can be specified in the dwStyle parameter:

LBS_DISABLENOSCROLL Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If you do not specify this style, the scroll bar is hidden when the list box does not contain enough items.

LBS_EXTENDEDSEL Allows multiple items to be selected by using the SHIFT key and the mouse or special key combinations.

LBS_HASSTRINGS Specifies that a list box contains items consisting of strings. The list box maintains the memory and addresses for the strings so the application can use the LB_GETTEXT message to retrieve the text for a particular item. By default, all list boxes except owner-drawn list boxes have this style. You can create an owner-drawn list box either with or without this style.

LBS_MULTICOLUMN Specifies a multicolumn list box that is scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.

LBS_MULTIPLESEL Turns string selection on or off each time the user clicks or double-clicks a string in the list box. The user can select any number of strings.

LBS_NODATA Specifies a no-data list box. Specify this style when the count of items in the list box will exceed one thousand. A no-data list box must also have the LBS_OWNERDRAWFIXED style, but must not have the LBS_SORT or LBS_HASSTRINGS style.
A no-data list box resembles an owner-drawn list box except that it contains no string or bitmap data for an item. Commands to add, insert, or delete an item always ignore any given item data; requests to find a string within the list box always fail. Windows sends the WM_DRAWITEM message to the owner window when an item must be drawn. The itemID member of the DRAWITEMSTRUCT structure passed with the WM_DRAWITEM message specifies the line number of the item to be drawn. A no-data list box does not send a WM_DELETEITEM message.

LBS_NOINTEGRALHEIGHT Specifies that the size of the list box is exactly the size specified by the application when it created the list box. Normally, Windows sizes a list box so that the list box does not display partial items.

LBS_NOREDRAW Specifies that the list box's appearance is not updated when changes are made. You can change this style at any time by sending a WM_SETREDRAW message.

LBS_NOSEL Specifies that the list box contains items that can be viewed but not selected.

LBS_NOTIFY Notifies the parent window with an input message whenever the user clicks or double-clicks a string in the list box.

LBS_OWNERDRAWFIXED Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are the same height. The owner window receives a WM_MEASUREITEM message when the list box is created and a WM_DRAWITEM message when a visual aspect of the list box has changed.

LBS_OWNERDRAWVARIABLE Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box has changed.

LBS_SORT Sorts strings in the list box alphabetically.

LBS_STANDARD Sorts strings in the list box alphabetically. The parent window receives an input message whenever the user clicks or double-clicks a string. The list box has borders on all sides.

LBS_USETABSTOPS Enables a list box to recognize and expand tab characters when drawing its strings. The default tab positions are 32 dialog box units. A dialog box unit is a horizontal or vertical distance. One horizontal dialog box unit is equal to one-fourth of the current dialog box base-width unit. Windows calculates these units based on the height and width of the current system font. The GetDialogBaseUnits function returns the current dialog box base units in pixels.

LBS_WANTKEYBOARDINPUT Specifies that the owner of the list box receives WM_VKEYTOITEM messages whenever the user presses a key and the list box has the input focus. This enables an application to perform special processing on the keyboard input.

The following scroll bar styles (in the SCROLLBAR class) can be specified in the dwStyle parameter:

SBS_BOTTOMALIGN Aligns the bottom edge of the scroll bar with the bottom edge of the rectangle defined by the parameters x, y, nWidth, and nHeight. The scroll bar has the default height for system scroll bars. Use this style with the SBS_HORZ style.

SBS_HORZ Designates a horizontal scroll bar. If neither the SBS_BOTTOMALIGN nor SBS_TOPALIGN style is specified, the scroll bar has the height, width, and position defined by x, y, nWidth, and nHeight.

SBS_LEFTALIGN Aligns the left edge of the scroll bar with the left edge of the rectangle defined by the parameters x, y, nWidth, and nHeight. The scroll bar has the default width for system scroll bars. Use this style with the SBS_VERT style.

SBS_RIGHTALIGN Aligns the right edge of the scroll bar with the right edge of the rectangle defined by the parameters x, y, nWidth, and nHeight. The scroll bar has the default width for system scroll bars. Use this style with the SBS_VERT style.

SBS_SIZEBOX Designates a size box. If you specify neither the SBS_SIZEBOXBOTTOMRIGHTALIGN nor the SBS_SIZEBOXTOPLEFTALIGN style, the size box has the height, width, and position specified by the parameters x, y, nWidth, and nHeight.

SBS_SIZEBOXBOTTOMRIGHTALIGN Aligns the lower-right corner of the size box with the lower-right corner of the rectangle specified by the parameters x, y, nWidth, and nHeight. The size box has the default size for system size boxes. Use this style with the SBS_SIZEBOX style.

SBS_SIZEBOXTOPLEFTALIGN Aligns the upper-left corner of the size box with the upper-left corner of the rectangle specified by the parameters x, y, nWidth, and nHeight. The size box has the default size for system size boxes. Use this style with the SBS_SIZEBOX style.

SBS_SIZEGRIP Same as SBS_SIZEBOX, but with a raised edge.

SBS_TOPALIGN Aligns the top edge of the scroll bar with the top edge of the rectangle defined by the parameters x, y, nWidth, and nHeight. The scroll bar has the default height for system scroll bars. Use this style with the SBS_HORZ style.
SBS_VERT Designates a vertical scroll bar. If you specify neither the SBS_RIGHTALIGN nor the SBS_LEFTALIGN style, the scroll bar has the height, width, and position specified by the parameters x, y, nWidth, and nHeight.

The following static control styles (in the STATIC class) can be specified in the dwStyle parameter.

A static control can have only one of these styles:

SS_BITMAP Specifies a bitmap is to be displayed in the static control. The error code text is the name of a bitmap (not a filename) defined elsewhere in the resource file. The style ignores the nWidth and nHeight parameters; the control automatically sizes itself to accommodate the bitmap.

SS_BLACKFRAME Specifies a box with a frame drawn in the same color as the window frames. This color is black in the default Windows color scheme.

SS_BLACKRECT Specifies a rectangle filled with the current window frame color. This color is black in the default Windows color scheme.

SS_CENTER Specifies a simple rectangle and centers the error code text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next centered line.

SS_CENTERIMAGE Specifies that the midpoint of a static control with the SS_BITMAP or SS_ICON style is to remain fixed when the control is resized. The four sides are adjusted to accommodate a new bitmap or icon.If a static control has the SS_BITMAP style and the bitmap is smaller than the control's client area, the client area is filled with the color of the pixel in the upper-left corner of the bitmap. If a static control has the SS_ICON style, the icon does not appear to paint the client area.

SS_GRAYFRAME Specifies a box with a frame drawn with the same color as the screen background (desktop). This color is gray in the default Windows color scheme.

SS_GRAYRECT Specifies a rectangle filled with the current screen background color. This color is gray in the default Windows color scheme.

SS_ICON Specifies an icon displayed in the dialog box. The given text is the name of an icon (not a filename) defined elsewhere in the resource file. The style ignores the nWidth and nHeight parameters; the icon automatically sizes itself.

SS_LEFT Specifies a simple rectangle and left-aligns the given text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next left-aligned line.

SS_LEFTNOWORDWRAP Specifies a simple rectangle and left-aligns the given text in the rectangle. Tabs are expanded but words are not wrapped. Text that extends past the end of a line is clipped.

SS_NOPREFIX Prevents interpretation of any ampersand (&) characters in the control's text as accelerator prefix characters. These are displayed with the ampersand removed and the next character in the string underlined. This static control style may be included with any of the defined static controls.
An application can combine SS_NOPREFIX with other styles by using the bitwise OR (|) operator. This can be useful when filenames or other strings that may contain an ampersand (&) must be displayed in a static control in a dialog box.

SS_NOTIFY Sends the parent window STN_CLICKED and STN_DBLCLK notification messages when the user clicks or double clicks the control.

SS_RIGHT Specifies a simple rectangle and right-aligns the given text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next right-aligned line.

SS_SIMPLE Specifies a simple rectangle and displays a single line of left-aligned text in the rectangle. The text line cannot be shortened or altered in any way. The control's parent window or dialog box must not process the WM_CTLCOLORSTATIC message.

SS_WHITEFRAME Specifies a box with a frame drawn with the same color as the window backgrounds. This color is white in the default Windows color scheme.

SS_WHITERECT Specifies a rectangle filled with the current window background color. This color is white in the default Windows color scheme.

The following dialog box styles can be specified in the dwStyle parameter:

DS_3DLOOK Gives the dialog box a nonbold font and draws three-dimensional borders around control windows in the dialog box.The DS_3DLOOK style is required only by Win32-based applications compiled for versions of Windows earlier than Windows 95 or Windows NT 4.0. The system automatically applies the three-dimensional look to dialog boxes created by applications compiled for current versions of Windows.

DS_ABSALIGN Indicates that the coordinates of the dialog box are screen coordinates; otherwise, Windows assumes they are client coordinates.

DS_CENTER Centers the dialog box in the working area; that is, the area not obscured by the tray.

DS_CENTERMOUSE Centers the mouse cursor in the dialog box.

DS_CONTEXTHELP Includes a question mark in the title bar of the dialog box. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message. The control should pass the message to the dialog procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the control.Note that DS_CONTEXTHELP is just a placeholder. When the dialog box is created, the system checks for DS_CONTEXTHELP and, if it is there, adds WS_EX_CONTEXTHELP to the extended style of the dialog box. WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.

DS_CONTROL Creates a dialog box that works well as a child window of another dialog box, much like a page in a property sheet. This style allows the user to tab among the control windows of a child dialog box, use its accelerator keys, and so on.

DS_FIXEDSYS Use SYSTEM_FIXED_FONT instead of SYSTEM_FONT.

DS_LOCALEDIT Applies to 16-bit applications only. This style directs edit controls in the dialog box to allocate memory from the application's data segment. Otherwise, edit controls allocate storage from a global memory object.

DS_MODALFRAME Creates a dialog box with a modal dialog-box frame that can be combined with a title bar and window menu by specifying the WS_CAPTION and WS_SYSMENU styles.

DS_NOFAILCREATE Creates the dialog box even if errors occur ¾ for example, if a child window cannot be created or if the system cannot create a special data segment for an edit control.

DS_NOIDLEMSG Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the owner of the dialog box while the dialog box is displayed.

DS_SETFONT Indicates that the dialog box template (the DLGTEMPLATE structure) contains two additional members specifying a font name and point size. The corresponding font is used to display text within the dialog box client area and within the dialog box controls. Windows passes the handle of the font to the dialog box and to each control by sending them the WM_SETFONT message.

DS_SETFOREGROUND Does not apply to 16-bit versions of Microsoft Windows. This style brings the dialog box to the foreground. Internally, Windows calls the SetForegroundWindow function for the dialog box.

DS_SYSMODAL Creates a system-modal dialog box. This style causes the dialog box to have the WS_EX_TOPMOST style, but otherwise has no effect on the dialog box or the behavior of other windows in the system when the dialog box is displayed.


Untitled Document

The WinApi.TextOut function writes a character string at the specified location, using the currently selected font.

boolean WinApi.TextOut(

number hdc, --handle of device context
number nXStart, --x-coordinate of starting position
number nYStart, --y-coordinate of starting position
string lpString, --text
);

Parameters

hdc

Identifies the device context.

nXStart

Specifies the logical x-coordinate of the reference point that Windows uses to align the string.

nYStart

Specifies the logical y-coordinate of the reference point that Windows uses to align the string.

lpString

text to be drawn.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.SetTextColor function sets the text color for the specified device context to the specified color

number WinApi.SetTextColor(

number hdc, --handle of device context
number crColor --text color value
);

Parameters

hdc

Identifies the device context.

crColor

Specifies the new text color.

this parameter can be a decimal color value ,it must be like this 123456 or 654321

Return Values

If the function succeeds, the return value specifies the previous text color as a Decimal Color value.
If the function fails, the return value is -1.


Untitled Document

The WinApi.Rectangle function fills a rectangle by using the specified brush. This function includes the left and top borders, but excludes the right and bottom borders of the rectangle.

boolean WinApi.Rectangle(

number hdc, --handle of device context
number nX, --x-coord.
number nY, --y-coord.
number nWidth, --width of rectangle
number nHeight --height of rectangle
number hBrush, --handle of device context
);

Parameters

hdc

Identifies the device context.

nX

Specifies the x-coordinate of the rectangle.

nY

Specifies the y-coordinate of the rectangle.

nWidth

Specifies the width of the rectangle.

nHeight

Specifies the height of the rectangle.

hBrush

Identifies the brush used to fill the rectangle.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.AngleArc function draws a line segment and an arc. The line segment is drawn from the current position to the beginning of the arc. The arc is drawn along the perimeter of a circle with the given radius and center. The length of the arc is defined by the given start and sweep angles.

boolean WinApi.AngleArc(

number hdc, --handle to device context
number X, --x-coordinate of circle's center
number Y, --y-coordinate of circle's center
number dwRadius, --circle's radius
number eStartAngle, --arc's start angle
number eSweepAngle --arc's sweep angle
);

Parameters

hdc

Identifies a device context.

X

Specifies the logical x-coordinate of the center of the circle.

Y

Specifies the logical y-coordinate of the center of the circle.

dwRadius

Specifies the radius, in logical units, of the circle. This value must be positive.

eStartAngle

Specifies the start angle, in degrees, relative to the x-axis.

eSweepAngle

Specifies the sweep angle, in degrees, relative to the starting angle.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

The WinApi.AngleArc function moves the current position to the ending point of the arc.
The arc drawn by this function may appear to be elliptical, depending on the current transformation and mapping mode. Before drawing the arc, WinApi.AngleArc draws the line segment from the current position to the beginning of the arc.
The arc is drawn by constructing an imaginary circle around the specified center point with the specified radius. The starting point of the arc is determined by measuring counterclockwise from the x-axis of the circle by the number of degrees in the start angle. The ending point is similarly located by measuring counterclockwise from the starting point by the number of degrees in the sweep angle.

If the sweep angle is greater than 360 degrees, the arc is swept multiple times.
This function draws lines by using the current pen. The figure is not filled.


Untitled Document

The WinApi.StrokeAndFillPath function closes any open figures in a path, strokes the outline of the path by using the current pen, and fills its interior by using the current brush.

boolean WinApi.StrokeAndFillPath(
number hDC --handle of device context
);

Parameters

hDC

Identifies the device context to be released.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

The device context identified by the hdc parameter must contain a closed path.
The WinApi.StrokeAndFillPath function has the same effect as closing all the open figures in the path, and stroking and filling the path separately, except that the filled region will not overlap the stroked region even if the pen is wide.


Untitled Document

The WinApi.SetBkMode function sets the background mix mode of the specified device context. The background mix mode is used with text, hatched brushes, and pen styles that are not solid lines.

number WinApi.SetBkMode(

number hdc, --handle of device context
number iBkMode --flag specifying background mode
);

Parameters

hdc

Identifies the device context.

iBkMode

Specifies the background mode. This parameter can be either of the following values:

OPAQUE Background is filled with the current background color before the text, hatched brush, or pen is drawn.
TRANSPARENT Background remains untouched.

Return Values

If the function succeeds, the return value specifies the previous background mode.
If the function fails, the return value is 0.

Remarks

The WinApi.SetBkMode function affects the line styles for lines drawn using a pen created by the WinApi.CreatePen function. WinApi.SetBkMode does not affect lines drawn using a pen created by the ExtCreatePen function.
The iBkMode parameter can also be set to driver-specific values. GDI passes such values to the device driver and otherwise ignores them.


Untitled Document

The WinApi.SetBkColor function sets the current background color to the specified color value, or to the nearest physical color if the device cannot represent the specified color value.

number WinApi.SetBkColor(

number hdc, --handle of device context
number crColor --background color value
);

Parameters

hdc

Identifies the device context.

crColor

Specifies the new background color.

this parameter can be a decimal color value ,it must be like this 123456 or 654321

Return Values

If the function succeeds, the return value specifies the previous background color as a Decimal Color value.
If the function fails, the return value is -1.

Remarks

This function fills the gaps between styled lines drawn using a pen created by the WinApi.CreatePen function; it does not fill the gaps between styled lines drawn using a pen created by the ExtCreatePen function.
If the background mode is OPAQUE, the background color is used to fill gaps between styled lines, gaps between hatched lines in brushes, and character cells. The background color is also used when converting bitmaps from color to monochrome and vice versa.


Untitled Document

The WinApi.SelectObject function selects an object into the specified device context. The new object replaces the previous object of the same type.

number WinApi.SelectObject(

number hdc, --handle of device context
number hgdiobj --handle of object
);

Parameters

hdc

Identifies the device context.

hgdiobj

Identifies the object to be selected. The specified object must have been created by using one of the following functions:

Bitmap CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap, CreateDIBitmap, CreateDIBSection
(Bitmaps can be selected for memory device contexts only, and for only one device context at a time.)
Brush CreateBrushIndirect, CreateDIBPatternBrush, CreateDIBPatternBrushPt, CreateHatchBrush, CreatePatternBrush, CreateSolidBrush
Font CreateFont, CreateFontIndirect
Pen CreatePen, CreatePenIndirect
Region CombineRgn, CreateEllipticRgn, CreateEllipticRgnIndirect, CreatePolygonRgn, CreateRectRgn, CreateRectRgnIndirect

Return Values

If the selected object is not a region and the function succeeds, the return value is the handle of the object being replaced. If the selected object is a region and the function succeeds, the return value is one of the following values:

Defined in WinApiConstants.lua
SIMPLEREGION Region consists of a single rectangle.
COMPLEXREGION Region consists of more than one rectangle.
NULLREGION Region is empty.

If an error occurs and the selected object is not a region, the return value is 0. Otherwise, it is -1.

Remarks

This function returns the previously selected object of the specified type. An application should always replace a new object with the original, default object after it has finished drawing with the new object.
An application cannot select a bitmap into more than one device context at a time.


Untitled Document

The WinApi.RoundRect function draws a rectangle with rounded corners. The rectangle is outlined by using the current pen and filled by using the current brush.

boolean WinApi.RoundRect(

number hdc, --handle of device context
number nX, --x-coord.
number nY, --y-coord.
number nWidth, --width of rectangle
number nHeight --height of rectangle
number cWidth, --width of ellipse used to draw rounded corners
number cHeight --height of ellipse used to draw rounded corners
);

Parameters

hdc

Identifies the device context.

nX

Specifies the x-coordinate of the rectangle.

nY

Specifies the y-coordinate of the rectangle.

nWidth

Specifies the width of the rectangle.

nHeight

Specifies the height of the rectangle.

cWidth

Specifies the width of the ellipse used to draw the rounded corners.

cHeight

Specifies the height of the ellipse used to draw the rounded corners.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.ReleaseDC function releases a device context (DC), freeing it for use by other applications. The effect of the WinApi.ReleaseDC function depends on the type of device context. It frees only common and window device contexts. It has no effect on class or private device contexts.

number WinApi.ReleaseDC(

number hWnd, --handle of window
number hDC --handle of device context
);

Parameters

hWnd

Identifies the window whose device context is to be released.

hDC

Identifies the device context to be released.

Return Values

The return value specifies whether the device context is released. If the device context is released, the return value is 1.
If the device context is not released, the return value is 0.

Remarks

The application must call the WinApi.ReleaseDC function for each call to the WinApi.GetWindowDC function and for each call to the WinApi.GetDC function that retrieves a common device context.


Untitled Document

The WinApi.Rectangle function draws a rectangle. The rectangle is outlined by using the current pen and filled by using the current brush.

boolean WinApi.Rectangle(

number hdc, --handle of device context
number nX, --x-coord.
number nY, --y-coord.
number nWidth, --width of rectangle
number nHeight --height of rectangle
);

Parameters

hdc

Identifies the device context.

nX

Specifies the x-coordinate of the rectangle.

nY

Specifies the y-coordinate of the rectangle.

nWidth

Specifies the width of the rectangle.

nHeight

Specifies the height of the rectangle.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.MoveToEx function updates the current position to the specified point

boolean WinApi.MoveToEx(

number hdc, --handle of device context
number X, --x-coordinate of new current position
number Y, --y-coordinate of new current position
);

Parameters

hdc

Identifies a device context.

X

Specifies the x-coordinate of the new position, in logical units.

Y

Specifies the y-coordinate of the new position, in logical units.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

The WinApi.MoveToEx function affects all drawing functions.


Untitled Document

The WinApi.LineTo function draws a line from the current position up to, but not including, the specified point.

boolean WinApi.LineTo(

number hdc, --device context handle
number nXEnd, --x-coordinate of line's ending point
number nYEnd --y-coordinate of line's ending point
);

Parameters

hdc

Identifies a device context.

nXEnd

Specifies the x-coordinate of the line's ending point.

nYEnd

Specifies the y-coordinate of the line's ending point.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

The coordinates of the line's ending point are specified in logical units.
The line is drawn by using the current pen and, if the pen is a geometric pen, the current brush.
If WinApi.LineTo succeeds, the current position is set to the specified ending point.


Untitled Document

The WinApi.GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area.

WinApi.GetWindowDC assigns default attributes to the window device context each time it retrieves the device context. Previous attributes are lost.

number WinApi.GetWindowDC(

number hWnd --handle of window
);

Parameters

hWnd

Identifies the window with a device context that is to be retrieved.

Return Values

If the function succeeds, the return value is the handle of a device context for the specified window.
If the function fails, the return value is 0, indicating an error or an invalid hWnd parameter.

Remarks

WinApi.GetWindowDC is intended for special painting effects within a window's nonclient area. Painting in nonclient areas of any window is not recommended.

The GetSystemMetrics function can be used to retrieve the dimensions of various parts of the nonclient area, such as the title bar, menu, and scroll bars.
After painting is complete, the WinApi.ReleaseDC function must be called to release the device context. Not releasing the window device context has serious effects on painting requested by applications.


Untitled Document

The WinApi.GetStockObject function retrieves a handle to one of the predefined stock pens, brushes, fonts, or palettes.

number WinApi.GetStockObject(

number fnObject --type of stock object
);

Parameters

fnObject

Specifies the type of stock object. This parameter can be any one of the following values:

BLACK_BRUSH Black brush.
DKGRAY_BRUSH Dark gray brush.
GRAY_BRUSH Gray brush.
HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).
LTGRAY_BRUSH Light gray brush.
NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH).
WHITE_BRUSH White brush.
BLACK_PEN Black pen.
NULL_PEN Null pen.
WHITE_PEN White pen.
ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font.
ANSI_VAR_FONT Windows variable-pitch (proportional space) system font.
DEVICE_DEFAULT_FONT Windows NT only: Device-dependent font.
DEFAULT_GUI_FONT Windows 95 only: Default font for user interface objects such as menus and dialog boxes.
OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.
SYSTEM_FONT System font. By default, Windows uses the system font to draw menus, dialog box controls, and text. In Windows versions 3.0 and later, the system font is a proportionally spaced font; earlier versions of Windows used a monospace system font.
SYSTEM_FIXED_FONT Fixed-pitch (monospace) system font used in Windows versions earlier than 3.0. This stock object is provided for compatibility with earlier versions of Windows.
DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette.

Return Values

If the function succeeds, the return value identifies the logical object requested.
If the function fails, the return value is 0.

Remarks

Use the DKGRAY_BRUSH, GRAY_BRUSH, and LTGRAY_BRUSH stock objects only in windows with the CS_HREDRAW and CS_VREDRAW styles. Using a gray stock brush in any other style of window can lead to misalignment of brush patterns after a window is moved or sized. The origins of stock brushes cannot be adjusted.
The HOLLOW_BRUSH and NULL_BRUSH stock objects are equivalent.
The font used by the DEFAULT_GUI_FONT stock object could change. Use this stock object when you want to use the font that menus, dialog boxes, and other user interface objects use.

It is not necessary (but it is not harmful) to delete stock objects by calling WinApi.DeleteObject.


Untitled Document

The WinApi.GetDC function retrieves a handle of a display device context (DC) for the client area of the specified window. The display device context can be used in subsequent GDI functions to draw in the client area of the window.

This function retrieves a common, class, or private device context depending on the class style specified for the specified window. For common device contexts, WinApi.GetDC assigns default attributes to the device context each time it is retrieved. For class and private device contexts, WinApi.GetDC leaves the previously assigned attributes unchanged.

number WinApi.GetDC(

number hWnd --handle of window
);

Parameters

hWnd

Identifies the window whose device context is to be retrieved.

Return Values

If the function succeeds, the return value identifies the device context for the given window's client area.
If the function fails, the return value is 0.

Remarks

After painting with a common device context, the WinApi.ReleaseDC function must be called to release the device context. Class and private device contexts do not have to be released. The number of device contexts is limited only by available memory.


Untitled Document

The WinApi.EndPath function closes a path bracket and selects the path defined by the bracket into the specified device context.

boolean WinApi.EndPath(
number hDC --handle of device context
);

Parameters

hDC

Identifies the device context into which the new path is selected.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.Ellipse function draws an ellipse. The center of the ellipse is the center of the specified bounding rectangle. The ellipse is outlined by using the current pen and is filled by using the current brush.

boolean WinApi.Ellipse(

number hdc, --handle of device context
number nX, --x-coord.
number nY, --y-coord.
number nWidth, --width of rectangle
number nHeight --height of rectangle
);

Parameters

hdc

Identifies the device context.

nX

Specifies the x-coordinate of the rectangle.

nY

Specifies the y-coordinate of the rectangle.

nWidth

Specifies the width of the rectangle.

nHeight

Specifies the height of the rectangle.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.DeleteObject function deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid.

boolean WinApi.DeleteObject(

number hObject --handle to graphic object
);

Parameters

hObject

Identifies a logical pen, brush, font, bitmap, region, or palette.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.
If the specified handle is not valid or is currently selected into a device context, the return value is FALSE.

Remarks

Do not delete a drawing object (pen or brush) while it is still selected into a device context.
When a pattern brush is deleted, the bitmap associated with the brush is not deleted. The bitmap must be deleted independently.


Untitled Document

The WinApi.CreateSolidBrush function creates a logical brush that has the specified solid color.

number WinApi.CreateSolidBrush(
string crColor --brush color value
);

Parameters

crColor

Specifies the color of the brush.

this parameter can be a decimal color value ,it must be like this 123456 or 654321

Return Values

If the function succeeds, the return value identifies a logical brush.
If the function fails, the return value is 0.

Remarks

A solid brush is a bitmap that Windows uses to paint the interiors of filled shapes.
After an application creates a brush by calling WinApi.CreateSolidBrush, it can select that brush into any device context by calling the WinApi.SelectObject function.

When you no longer need the brush, call the WinApi.DeleteObject function to delete it.


Untitled Document

The WinApi.CreatePen function creates a logical pen that has the specified style, width, and color. The pen can subsequently be selected into a device context and used to draw lines and curves.

number WinApi.CreatePen(

string fnPenStyle, --pen style
number nWidth, --pen width
string crColor --pen color
);

Parameters

fnPenStyle

Specifies the pen style. It can be any one of the following values:

PS_SOLID Pen is solid.
PS_DASH Pen is dashed. This style is valid only when the pen width is one or less in device units.
PS_DOT Pen is dotted. This style is valid only when the pen width is one or less in device units.
PS_DASHDOT Pen has alternating dashes and dots. This style is valid only when the pen width is one or less in device units.
PS_DASHDOTDOT Pen has alternating dashes and double dots. This style is valid only when the pen width is one or less in device units.
PS_NULL Pen is invisible.
PS_INSIDEFRAME Pen is solid. When this pen is used in any graphics device interface (GDI) drawing function that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. This applies only to geometric pens.

nWidth

Specifies the width of the pen, in logical units. If nWidth is zero, the pen is a single pixel wide, regardless of the current transformation.

crColor

Specifies a color reference for the pen color.

this parameter can be a decimal color value , it must be like this 123456 or 654321

Return Values

If the function succeeds, the return value is a handle that identifies a logical pen.
If the function fails, the return value is 0.

Remarks

After an application creates a logical pen, it can select that pen into a device context by calling the SelectObject function. After a pen is selected into a device context, it can be used to draw lines and curves.
If the value specified by the nWidth parameter is zero, a line drawn with the created pen will always be a single pixel wide regardless of the current transformation.
If the value specified by nWidth is greater than 1, the fnPenStyle parameter must be PS_NULL, PS_SOLID, or PS_INSIDEFRAME.

If the value specified by nWidth is greater than 1 and fnPenStyle is PS_INSIDEFRAME, the line associated with the pen is drawn inside the frame of all primitives except polygons and polylines.
If the value specified by nWidth is greater than 1, fnPenStyle is PS_INSIDEFRAME, and the color specified by the crColor parameter does not match one of the entries in the logical palette, Windows draws lines by using a dithered color. Dithered colors are not available with solid pens.

When you no longer need the pen, call the WinApi.DeleteObject function to delete it.


Untitled Document

The WinApi.BeginPath function opens a path bracket in the specified device context.

boolean WinApi.BeginPath(

number hdc --handle to device context
);

Parameters

hdc

Identifies the device context.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

After a path bracket is open, an application can begin calling GDI drawing functions to define the points that lie in the path. An application can close an open path bracket by calling the WinApi.EndPath function.
When an application calls WinApi.BeginPath for a device context, any previous paths are discarded from that device context.


Untitled Document

The Winapi.SetPixel function sets the pixel at the specified coordinates to the specified color.

number WinApi.SetPixel(

number hdc, --handle of device context
number X, --x-coordinate of pixel
number Y, --y-coordinate of pixel
number crColor --pixel color
);

Parameters

hdc

Identifies the device context.

X

Specifies the x-coordinate, in logical units, of the point to be set.

Y

Specifies the y-coordinate, in logical units, of the point to be set.

crColor

Specifies the color to be used to paint the point.

this parameter can be a decimal color value ,it must be like this 123456 or 654321

Return Values

If the function succeeds, the return value is the Decimal color value that the function sets the pixel to. This value may differ from the color specified by crColor; that happens when an exact match for the specified color cannot be found.
If the function fails, the return value is -1.

Remarks

The function fails if the pixel coordinates lie outside of the current clipping region.
Not all devices support the WinApi.SetPixel function.


Untitled Document

The WinApi.GetPixel function retrieves the Decimal color value of the pixel at the specified coordinates.

number WinApi.GetPixel(

number hdc, --handle of device context
number nXPos, --x-coordinate of pixel
number nYPos --y-coordinate of pixel
);

Parameters

hdc

Identifies the device context.

nXPos

Specifies the logical x-coordinate of the pixel to be examined.

nYPos

Specifies the logical y-coordinate of the pixel to be examined.

Return Values

If the function succeeds, the return value is an Decimal color value. If the pixel is outside of the current clipping region, the return value is -1.

Remarks

The pixel must be within the boundaries of the current clipping region.
Not all devices support WinApi.GetPixel.


Untitled Document

The WinApi.CreateFont function creates a logical font that has specific characteristics. The logical font can subsequently be selected as the font for any device.

number WinApi.CreateFont(

number DC, --device context.
string fFace --font face name
number fSize, --font size
number fnWeight, --font weight
boolean fdwItalic, --italic attribute flag
boolean fdwUnderline, --underline attribute flag
boolean fdwStrikeOut, --strikeout attribute flag
number fdwCharSet, --character set identifier
);

Parameters

DC

Identifies the device context.

fFace

Identifies the Font Face Name

fSize

Identifies the Font size

fnWeight

Specifies the weight of the font in the range 0 through 1000. For example, 400 is normal and 700 is bold. If this value is zero, a default weight is used.

The following values are defined for convenience:
FW_DONTCARE 0
FW_THIN 100
FW_EXTRALIGHT 200
FW_ULTRALIGHT 200
FW_LIGHT 300
FW_NORMAL 400
FW_REGULAR 400
FW_MEDIUM 500
FW_SEMIBOLD 600
FW_DEMIBOLD 600
FW_BOLD 700
FW_EXTRABOLD 800
FW_ULTRABOLD 800
FW_HEAVY 900
FW_BLACK 900

fdwItalic

Specifies an italic font if set to TRUE.

fdwUnderline

Specifies an underlined font if set to TRUE.

fdwStrikeOut

Specifies a strikeout font if set to TRUE.

fdwCharSet

Specifies the character set. The following values are predefined:

ANSI_CHARSET
DEFAULT_CHARSET
SYMBOL_CHARSET
SHIFTJIS_CHARSET
GB2312_CHARSET
HANGEUL_CHARSET
CHINESEBIG5_CHARSET
OEM_CHARSET

Windows 95 only:

JOHAB_CHARSET
HEBREW_CHARSET
ARABIC_CHARSET
GREEK_CHARSET
TURKISH_CHARSET
THAI_CHARSET
EASTEUROPE_CHARSET
RUSSIAN_CHARSET
MAC_CHARSET
BALTIC_CHARSET

The OEM_CHARSET value specifies a character set that is operating-system dependent.
You can use the DEFAULT_CHARSET value to allow the name and size of a font to fully describe the logical font. If the specified font name does not exist, a font from any character set can be substituted for the specified font, so you should use DEFAULT_CHARSET sparingly to avoid unexpected results.
Fonts with other character sets may exist in the operating system. If an application uses a font with an unknown character set, it should not attempt to translate or interpret strings that are rendered with that font.

This parameter is important in the font mapping process. To ensure consistent results, specify a specific character set. If you specify a typeface name in the fFace parameter, make sure that the fdwCharSet value matches the character set of the typeface specified in fFace.

Return Values

If the function succeeds, the return value is a handle to a logical font.
If the function fails, the return value is 0

Remarks

When you no longer need the font, call the WinApi.DeleteObject function to delete it.


Untitled Document

The WinApi.RGBToHexColor function converts a RGB color value to Hex color value EX:((255,0,0) to "FF0000")

string WinApi.RGBToHexColor(
number rVal --red channel
number gVal --green channel
number bVal --blue channel
);

Parameters

rVal

specifies the red channel

gVal

specifies the green channel

bVal

specifies theblue channel

Return Values

If the function succeeds, the return value is a Hex value in this format "FFFFFF"
If the function fails, the return value is 0. (string)


Untitled Document

The WinApi.IntToStr function converts a number to string

string WinApi.IntToStr(
number nVal --number
);

Parameters

nVal

Identifies the numerical value ,this value can be both a number (int) and a floating point value (float)

Return Values

If the function succeeds, the return value is number in string format
If the function fails, the return value is "". (string)

Remarks

also, you can convert a number to string with standart Lua code internally

result = string.format("%s",12345);

result will be "12345"


Untitled Document

The WinApi.Int function converts a (float) floating point value to (int) number Ex: ( 123.123 To 123) or (-123.123 To -123)

number WinApi.Int(
number fVal --number
);

Parameters

fVal

Identifies the floating point value (float)

Return Values

If the function succeeds, the return value is number (int)
If the function fails, the return value is 0.


Untitled Document

The WinApi.DecToRGBColor function converts a Decimal color value to RGB color value EX:(0 to (0,0,0)

table WinApi.DecToRGBColor(

number dVal --decimal color
);

Parameters

dVal

Decimal color value to be converted to RGB color

Return Values

If the function succeeds, the return value is table containing RGB values

result = WinApi.DecToRGBColor(255);

result.Red = 255;
result.Green = 0;
result.Blue = 0;

If the function fails, the return value is

result.Red = 0;
result.Green = 0;
result.Blue = 0;


Untitled Document

The WinApi.DecToHexColor function converts a Decimal color value to Hex color value EX: (255 to "FF0000")

string WinApi.DecToHexColor(
number dVal --decimal color
);

Parameters

dVal

Decimal color value to be converted to hex color

Return Values

If the function succeeds, the return value is a Hex value in this format "FFFFFF"
If the function fails, the return value is 0. (string)


Untitled Document

The WinApi.DelimitedStringToTable function converts a delimited string to a Lua table.

table WinApi.DelimitedStringToTable(
string dlmtString, // delimited string
string delimiter // delimiter
);

Parameters

dlmtString

Identifies the delimited string for example : "abc|cde|asw" or "abc~@cde~@asw"

delimiter

Identifies the delimiter can be one or more letter/char for example : "|-|" or "~~" or "|"

Return Values

rTable = WinApi.DelimitedStringToTable("abs|asd|sdf", "|");

If the function succeeds, the return value is a table
rTable[1] = "abs";
rTable[2] = "asd";
rTable[3] = "sdf";

If the function fails, the return value is
rTable[1] = "";

you can determine error:

if (rTable[1] == "") then

--Error

end

Also

if you used or a function returned a normal string

rTable = WinApi.DelimitedStringToTable("abs", "|");

the return value will be

rTable[1] = "abs";


Untitled Document

The WinApi.ClipBoardIsEmpty function determines whether text is available on the Windows clipboard

boolean WinApi.ClipBoardIsEmpty();

Parameters

this function has no parameter

Return Values

If clipboard is empty , the return value is TRUE.
If clipboard is not empty, the return value is FALSE.


Untitled Document

The WinApi.ClipBoardGetText function retrieves text from the Windows clipboard

string WinApi.ClipBoardGetText();

Parameters

this function has no parameters

Return Values

If the function succeeds, the return value is retrieved text from clipboard

if function fails or clipboard is empty ,the return value is ""


Untitled Document

The WinApi.ClipBoardPutText function copies text to the Windows clipboard

boolean WinApi.ClipBoardPutText(
string lpString --text to copy to the clipboard
);

Parameters

lpString

The text to copy to the clipboard

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.ImageIsValid function determines whether specified file is a valid image

boolean WinApi.ImageIsValid(

string File --input file
);

Parameters

File

Identifies the input image file.

Return Values

If specified file is a valid image ( gif , jpg , bmp , png , tif , wmf , ico), the return value is TRUE.
If specified file is not a valid image, the return value is FALSE.


Untitled Document

The WinApi.ImageConvertTo function converts an image to an other format

string WinApi.ImageConvertTo(

string InimgFile --input image file
string OutimgFile --output image file
);

Parameters

InimgFile

Identifies the input image file. can be in these formats ( gif , jpg , bmp , png , tif , wmf)

OutimgFile

Identifies the ouput image file. can be in these formats ( gif , jpg , bmp , png , tif , wmf)

Return Values

If the function succeeds, the return value is "OK"
If the input file is not a valid image or image file could not found, the return value is "ERROR"
If the output file path is not correct or conversion failed, the return value is "ERROR2"


Untitled Document

The WinApi.ImageGetSize function retrieves the width and height of an image

table WinApi.ImageGetSize(

string imgFile --image file
);

Parameters

imgFile

Identifies the image file. can be in these formats ( gif , jpg , bmp , ico , png , tif , wmf)

Return Values

If the function succeeds, the return value is table containing width and height of specified image

result = WinApi.ImageGetSize("C:\\MyImage.jpg");

result.Width;
result.Height;

If the function fails, the return value is nil

if result ~= nil then
--do anything here
end


Untitled Document

The WinApi.EnumerateFonts function enumerates avilable fonts on the system for specified character set. use DEFAULT_CHARSET for the enumerate all installed fonts

table WinApi.CreateFont(
number fdwCharSet, --character set identifier
);

Parameters

fdwCharSet

Specifies the character set. The following values are predefined:

ANSI_CHARSET
DEFAULT_CHARSET
SYMBOL_CHARSET
SHIFTJIS_CHARSET
GB2312_CHARSET
HANGEUL_CHARSET
CHINESEBIG5_CHARSET
OEM_CHARSET

JOHAB_CHARSET
HEBREW_CHARSET
ARABIC_CHARSET
GREEK_CHARSET
TURKISH_CHARSET
THAI_CHARSET
EASTEUROPE_CHARSET
RUSSIAN_CHARSET
MAC_CHARSET
BALTIC_CHARSET

Return Values

If the function succeeds, the return value is a numerically indexed table that contains font names.
If the function fails, the return value is nil
If the function could not found a font for specified character set ,the return value table[1] = "";

Remarks
For the enumerate all installed fonts use DEFAULT_CHARSET


Untitled Document

The WinApi.MciSendString function sends a MCI command string and returns a value if necessary.

string WinApi.MciSendString(

string lpszCommand,
number hwndCallback
);

Parameters

lpszCommand

Identifies the MCI command string (string can be maximum 128 characters legth)

hwndCallback

Handle of a callback window if the "notify" flag was specified in the command string.

Return Values

If the function succeeds,returns a value if necessary - nothing otherwise
If the function fails, the return value is "ERROR"


Untitled Document

The WinApi.SetDisplaySettingsQ function changes the settings of the default display device to the specified size (Width x Height) and without change Bits and Frequency values

number WinApi.SetDisplaySettingsQ(

number nWidth, --display width
number nHeight, --display height
);

Parameters

nWidth

Specifies the new width of the display.

nHeight

Specifies the new height of the display.

Return Values

If the function succeeds, the return value is 0.
If the function fails, the return value is one of following

1 The computer must be restarted in order for the graphics mode to work.

-1 The display driver failed the specified graphics mode.

-2 The graphics mode is not supported.

-3 Windows NT/2000/XP: Unable to write settings to the registry.

-4 An invalid set of flags was passed in.

-5 An invalid parameter was passed in. This can include an invalid flag or combination of flags.

-6 Windows XP: The settings change was unsuccessful because system is DualView capable.


Untitled Document

The WinApi.SetDisplaySettings function changes the settings of the default display device to the specified graphics mode.

number WinApi.SetDisplaySettings(

number nWidth, --display width
number nHeight, --display height
number Bits, --bits per pixel
number Freq, --mode frequency
);

Parameters

nWidth

Specifies the new width of the display.

nHeight

Specifies the new height of the display.

Bits

Specifies the new Bit value of the display.

Freq

Specifies the new frequency value of the display.

Return Values

If the function succeeds, the return value is 0.
If the function fails, the return value is one of following

1 The computer must be restarted in order for the graphics mode to work.

-1 The display driver failed the specified graphics mode.

-2 The graphics mode is not supported.

-3 Windows NT/2000/XP: Unable to write settings to the registry.

-4 An invalid set of flags was passed in.

-5 An invalid parameter was passed in. This can include an invalid flag or combination of flags.

-6 Windows XP: The settings change was unsuccessful because system is DualView capable.


Untitled Document

The WinApi.PlaySound function plays a waveform sound (WAV) file

boolean WinApi.PlaySound(

string lpszSound, --file path of a Wav file
string fuSound --play method
);

Parameters

lpszSound

A string that specifies the soundfile to play

fuSound

Flags for playing the sound. The following values are defined:

SND_ASYNC

The sound is played asynchronously and the function returns immediately after beginning the sound.

if this flag is used ,to Stop a playing sound use : WinApi.PlaySound("");

SND_SYNC

The sound is played synchronously and the function does not return until the sound ends.

Return Values

Returns TRUE if successful or FALSE otherwise.

Remarks

this function can play only Wav Format


Untitled Document

The WinApi.OpenFilePropertiesDlg function opens system default file properties dialog for a specified file

boolean WinApi.OpenFilePropertiesDlg(
string lpFile --path of file
);

Parameters

lpFile

Identifies the file to be Prop. Dialog Opened (Full Path Required)

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.MouseMove function moves the cursor to the specified screen coordinates. If the new coordinates are not within the screen rectangle set by the most recent ClipCursor function, Windows automatically adjusts the coordinates so that the cursor stays within the rectangle.

boolean WinApi.MouseMove(

number X, --horizontal position
number Y --vertical position
);

Parameters

X

Specifies the new x-coordinate, in screen coordinates, of the cursor.

Y

Specifies the new y-coordinate, in screen coordinates, of the cursor.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks

The cursor is a shared resource. A window should move the cursor only when the cursor is in its client area.


Untitled Document

The WinApi.MouseClick function performs a mouse click operation ONCE

WinApi.MouseClick(

string Button, --mouse button
);

Parameters

Button

Specifies the mouse button to click, this argument can be foolowing

Left left mouse button

Middle middle mouse button

Right right mouse button

Return Values

this funstion has no return value

Remarks

this function performs a mouse click operation ONES
if you want to a double click

Try

WinApi.MouseClick("Left");
Application.Sleep(5);
WinApi.MouseClick("Left");


Untitled Document

The WinApi.HtmlHelp function opens Html help file (chm) with specified topic.

number WinApi.HtmlHelp(

number WndHandle, // caller window
string cHm, // chm help file
string hTml // topic file
);

Parameters

WndHandle

Identifies the caller window , if this window closed help window will be destroyed with specified window

cHm

Identifies the help file (chm) file path(full path required).

hTml

Identifies the (html) topic file ex:(licence.html).

Return Values

If the function succeeds, the return value is the handle to the help window

you can close help window Window.Close(); then any time you want
If the function fails, the return value is 0.


Untitled Document

The WinApi.GetTickCount function retrieves the number of milliseconds that have elapsed since Windows was started.

number WinApi.GetTickCount();

Parameters

This function has no parameters.

Return Values

If the function succeeds, the return value is the number of milliseconds that have elapsed since Windows was started.

Remarks

The elapsed time is stored as a number value. Therefore, the time will wrap around to zero if Windows is run continuously for 49.7 days.
Windows NT: To obtain the time elapsed since the computer was started, look up the System Up Time counter in the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8 byte value.


Untitled Document

The WinApi.GetLocaleInfo function retrieves information about a locale.

string WinApi.GetLocaleInfo(

string Locale, --locale identifier
string LCType, --type of information
);

Parameters

Locale

Specifies the locale to retrieve information for. This parameter can be one of the following predefined values:

LOCALE_SYSTEM_DEFAULT Default system locale.
LOCALE_USER_DEFAULT Default user locale.

LCType

Specifies the locale info type to retrieve information , this parameter can be one of following

Note: Combination is not allowed

LOCALE_ILANGUAGE

Language identifier indicating the language. The maximum number of characters allowed for this string is 5.

LOCALE_SLANGUAGE

Full localized name of the language.

LOCALE_SENGLANGUAGE

Full English name of the language from the International Organization for Standardization (ISO) Standard 639. This is always restricted to characters mappable into the ASCII 127-character subset.

LOCALE_SABBREVLANGNAME

Abbreviated name of the language, created by taking the 2-letter language abbreviation from the ISO Standard 639 and adding a third letter, as appropriate, to indicate the sublanguage.

LOCALE_SNATIVELANGNAME

Native name of the language.

LOCALE_ICOUNTRY

Country code, based on international phone codes, also referred to as IBM country codes. The maximum number of characters allowed for this string is 6.

LOCALE_SCOUNTRY

Full localized name of the country.

LOCALE_SENGCOUNTRY

Full English name of the country. This is always restricted to characters mappable into the ASCII 127-character subset.

LOCALE_SABBREVCTRYNAME

Abbreviated name of the country from the ISO Standard 3166.

LOCALE_SNATIVECTRYNAME

Native name of the country.

LOCALE_IDEFAULTLANGUAGE

Language identifier for the principal language spoken in this locale. This is provided so that partially specified locales can be completed with default values. The maximum number of characters allowed for this string is 5.

LOCALE_IDEFAULTCOUNTRY

Country code for the principal country in this locale. This is provided so that partially specified locales can be completed with default values. The maximum number of characters allowed for this string is 6.

LOCALE_IDEFAULTANSICODEPAGE

American National Standards Institute (ANSI) code page associated with this locale. The maximum number of characters allowed for this string is 6.

LOCALE_IDEFAULTOEMCODEPAGE

Original equipment manufacturer (OEM) code page associated with the locale. The maximum number of characters allowed for this string is 6.

LOCALE_IDEFAULTCODEPAGE

Original equipment manufacturer (OEM) code page associated with the country. The maximum number of characters allowed for this string is 6.

LOCALE_SLIST

Character(s) used to separate list items. For example, a comma is used in many locales.

LOCALE_IMEASURE

System of measurement. This value is 0 if the metric system (Systéme International d'Unités, or S.I.) is used and 1 if the U.S. system is used. The maximum number of characters allowed for this string is 2.

LOCALE_SDECIMAL

Character(s) used as the decimal separator.

LOCALE_STHOUSAND

Character(s) used to separate groups of digits to the left of the decimal.

LOCALE_SGROUPING

Sizes for each group of digits to the left of the decimal. An explicit size is needed for each group; sizes are separated by semicolons. If the last value is zero, the preceding value is repeated. To group thousands, specify 3;0, for example.

LOCALE_IDIGITS

Number of fractional digits. The maximum number of characters allowed for this string is 3.

LOCALE_ILZERO

Specifier for leading zeros in decimal fields. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values:

0 No leading zeros
1 Leading zeros

LOCALE_INEGNUMBER

Negative number mode. The mode can be one of these values:

0 (1.1)
1 -1.1
2 - 1.1
3 1.1-
4 1.1 -

LOCALE_SNATIVEDIGITS

Native equivalents to ASCII 0 through 9.

LOCALE_SCURRENCY

String used as the local monetary symbol.

LOCALE_SINTLSYMBOL

Three characters of the international monetary symbol specified in ISO 4217, "Codes for the Representation of Currencies and Funds," followed by the character separating this string from the amount.

LOCALE_SMONDECIMALSEP

Character(s) used as the monetary decimal separator.

LOCALE_SMONTHOUSANDSEP

Character(s) used as the monetary separator between groups of digits to the left of the decimal.

LOCALE_SMONGROUPING

Sizes for each group of monetary digits to the left of the decimal. An explicit size is needed for each group; sizes are separated by semicolons. If the last value is zero, the preceding value is repeated. To group thousands, specify 3;0, for example.

LOCALE_ICURRDIGITS

Number of fractional digits for the local monetary format. The maximum number of characters allowed for this string is 3.

LOCALE_IINTLCURRDIGITS

Number of fractional digits for the international monetary format. The maximum number of characters allowed for this string is 3.

LOCALE_ICURRENCY

Positive currency mode. The maximum number of characters allowed for this string is 2. The mode can be one of the following values:

0 Prefix, no separation
1 Suffix, no separation
2 Prefix, 1-char. separation
3 Suffix, 1-char. separation

LOCALE_INEGCURR

Negative currency mode. The maximum number of characters allowed for this string is 3. The mode can be one of the following values:

0 ($1.1)
1 -$1.1
2 $-1.1
3 $1.1-
4 (1.1$)
5 -1.1$
6 1.1-$
7 1.1$-
8 -1.1 $ (space before $)
9 -$ 1.1 (space after $)
10 1.1 $- (space before $)
11 $ 1.1- (space after $)
12 $ -1.1 (space after $)
13 1.1- $ (space before $)
14 ($ 1.1) (space after $)
15 (1.1 $) (space before $)

LOCALE_SDATE

Character(s) for the date separator.

LOCALE_STIME

Character(s) for the time separator.

LOCALE_STIMEFORMAT

Time formatting strings for this locale. The string can consist of a combination of the hour, minute, and second format pictures defined in in the Hour, Minute, and Second Format Pictures table in National Language Support Constants.

LOCALE_SSHORTDATE

Short date formatting string for this locale. The string can consist of a combination of day, month, and year format pictures defined in in Day, Month, Year, and Era Format Pictures table in National Language Support Constants.

LOCALE_SLONGDATE

Long date formatting string for this locale. The string can consist of a combination of day, month, and year format pictures defined in in the Day, Month, Year, and Era Format Pictures table in National Language Support Constantsand any string of characters enclosed in single quotes. Characters in single quotes remain as given.

LOCALE_IDATE

Short date format-ordering specifier. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values:

0 Month-Day-Year
1 Day-Month-Year
2 Year-Month-Day

LOCALE_ILDATE

Long date format-ordering specifier. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values:

0 Month-Day-Year
1 Day-Month-Year
2 Year-Month-Day

LOCALE_ITIME

Time format specifier. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values:

0 AM / PM 12-hour format
1 24-hour format

LOCALE_ICENTURY

Specifier for full 4-digit century. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values:

0 Abbreviated 2-digit century
1 Full 4-digit century

LOCALE_ITLZERO

Specifier for leading zeros in time fields. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values:

0 No leading zeros for hours
1 Leading zeros for hours

LOCALE_IDAYLZERO

Specifier for leading zeros in day fields. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values:

0 No leading zeros for days
1 Leading zeros for days

LOCALE_IMONLZERO

Specifier for leading zeros in month fields. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values:

0 No leading zeros for months
1 Leading zeros for months

LOCALE_S1159

String for the AM designator.

LOCALE_S2359

String for the PM designator.

LOCALE_ICALENDARTYPE

Current calendar type. This type can be one of these values:

1 Gregorian (as in United States)
2 Gregorian (English strings always)
3 Era: Year of the Emperor (Japan)
4 Era: Year of the Republic of China
5 Tangun Era (Korea)

LOCALE_IOPTIONALCALENDAR

Additional calendar types. This can be a zero-separated list of one or more of these calendars type values:

0 No additional types valid
1 Gregorian (as in United States)
2 Gregorian (English strings always)
3 Era: Year of the Emperor (Japan)
4 Era: Year of the Republic of China
5 Tangun Era (Korea)

LOCALE_IFIRSTDAYOFWEEK

Specifier for the first day in a week. The specifier can be one of these values:

0 LOCALE_SDAYNAME1
1 LOCALE_SDAYNAME2
2 LOCALE_SDAYNAME3
3 LOCALE_SDAYNAME4
4 LOCALE_SDAYNAME5
5 LOCALE_SDAYNAME6
6 LOCALE_SDAYNAME7

LOCALE_IFIRSTWEEKOFYEAR

Specifier for the first week of the year. The specifier can be one of these values:

0 Week containing 1/1 is the first week of that year.
1 First full week following 1/1 is the first week of that year.
2 First week containing at least 4 days is the first week of that year.

LOCALE_SDAYNAME1

Native long name for Monday.

LOCALE_SDAYNAME2

Native long name for Tuesday.

LOCALE_SDAYNAME3

Native long name for Wednesday.

LOCALE_SDAYNAME4

Native long name for Thursday.

LOCALE_SDAYNAME5

Native long name for Friday.

LOCALE_SDAYNAME6

Native long name for Saturday.

LOCALE_SDAYNAME7

Native long name for Sunday.

LOCALE_SABBREVDAYNAME1

Native abbreviated name for Monday.

LOCALE_SABBREVDAYNAME2

Native abbreviated name for Tuesday.

LOCALE_SABBREVDAYNAME3

Native abbreviated name for Wednesday.

LOCALE_SABBREVDAYNAME4

Native abbreviated name for Thursday.

LOCALE_SABBREVDAYNAME5

Native abbreviated name for Friday.

LOCALE_SABBREVDAYNAME6

Native abbreviated name for Saturday.

LOCALE_SABBREVDAYNAME7

Native abbreviated name for Sunday.

LOCALE_SMONTHNAME1

Native long name for January.

LOCALE_SMONTHNAME2

Native long name for February.

LOCALE_SMONTHNAME3

Native long name for March.

LOCALE_SMONTHNAME4

Native long name for April.

LOCALE_SMONTHNAME5

Native long name for May.

LOCALE_SMONTHNAME6

Native long name for June.

LOCALE_SMONTHNAME7

Native long name for July.

LOCALE_SMONTHNAME8

Native long name for August.

LOCALE_SMONTHNAME9

Native long name for September.

LOCALE_SMONTHNAME10

Native long name for October.

LOCALE_SMONTHNAME11

Native long name for November.

LOCALE_SMONTHNAME12

Native long name for December.

LOCALE_SMONTHNAME13

Native name for 13th month, if exists.

LOCALE_SABBREVMONTHNAME1

Native abbreviated name for January.

LOCALE_SABBREVMONTHNAME2

Native abbreviated name for February.

LOCALE_SABBREVMONTHNAME3

Native abbreviated name for March.

LOCALE_SABBREVMONTHNAME4

Native abbreviated name for April.

LOCALE_SABBREVMONTHNAME5

Native abbreviated name for May.

LOCALE_SABBREVMONTHNAME6

Native abbreviated name for June.

LOCALE_SABBREVMONTHNAME7

Native abbreviated name for July.

LOCALE_SABBREVMONTHNAME8

Native abbreviated name for August.

LOCALE_SABBREVMONTHNAME9

Native abbreviated name for September.

LOCALE_SABBREVMONTHNAME10

Native abbreviated name for October.

LOCALE_SABBREVMONTHNAME11

Native abbreviated name for November.

LOCALE_SABBREVMONTHNAME12

Native abbreviated name for December.

LOCALE_SABBREVMONTHNAME13

Native abbreviated name for 13th month, if exists.

LOCALE_SPOSITIVESIGN

String value for the positive sign.

LOCALE_SNEGATIVESIGN

String value for the negative sign.

LOCALE_IPOSSIGNPOSN

Formatting index for positive values. The maximum number of characters allowed for this string is 2. The index can be one of the following values:

0 Parentheses surround the amount and the monetary symbol.
1 The sign string precedes the amount and the monetary symbol.
2 The sign string succeeds the amount and the monetary symbol.
3 The sign string immediately precedes the monetary symbol.
4 The sign string immediately succeeds the monetary symbol.

LOCALE_INEGSIGNPOSN

Formatting index for negative values. This index uses the same values as LOCALE_IPOSSIGNPOSN. The maximum number of characters allowed for this string is 2.

LOCALE_IPOSSYMPRECEDES

Position of monetary symbol in a positive monetary value. This value is 1 if the monetary symbol precedes the positive amount, 0 if it follows it. The maximum number of characters allowed for this string is 2.

LOCALE_IPOSSEPBYSPACE

Separation of monetary symbol in a positive monetary value. This value is 1 if the monetary symbol is separated by a space from a positive amount, 0 if it is not. The maximum number of characters allowed for this string is 2.

LOCALE_INEGSYMPRECEDES

Position of monetary symbol in a negative monetary value. This value is 1 if the monetary symbol precedes the negative amount, 0 if it follows it. The maximum number of characters allowed for this string is 2.

LOCALE_INEGSEPBYSPACE

Separation of monetary symbol in a negative monetary value. This value is 1 if the monetary symbol is separated by a space from the negative amount, 0 if it is not. The maximum number of characters allowed for this string is 2.

LOCALE_NOUSEROVERRIDE

Can be combined with other LOCALE values to bypass any user override and return the system default value for the given locale information.

Many of the locale types listed above are closely related, such that changing one affects the value of others. The following shows the relationships between these types.

LOCALE_ICURRENCY

LOCALE_IPOSSEPBYSPACE, LOCALE_IPOSSYMPRECEDES

LOCALE_INEGCURR

LOCALE_INEGSEPBYSPACE, LOCALE_INEGSYMPRECEDES, LOCALE_INEGSIGNPOSN, LOCALE_IPOSSIGNPOSN

LOCALE_SSHORTDATE

LOCALE_SDATE, LOCALE_IDATE

LOCALE_SLONGDATE

LOCALE_ILDATE

LOCALE_STIMEFORMAT

LOCALE_STIME, LOCALE_ITIME, LOCALE_ITLZERO

Return Values

If the function succeeds, return value is requested Value,

If an error occured, the return value is "0" (zero) or "" (empty string)

Remarks

The WinApi.GetLocaleInfo function always retrieves information in text format. If the information is a numeric value, the function converts the number to text using decimal notation.


Untitled Document

The WinApi.GetFolderSize function returns size of a specified folder(in bytes)

number WinApi.GetFolderSize(
string fPath --folder path
);

Parameters

fPath

Identifies the folder path Ex: "C:\\MyFolder\\"

Return Values

If the function succeeds, the return value is size of folder (in Bytes)
If the function fails,or specified folder does not exist the return value is 0.

Remarks

when you you use this function with large folders about (5 GB - 10 GB) this application may take a long time
for example: getting a folder size (30 GB) may take about 1 minute

also this function may return used size of a drive quickly

for Example:

result = WinApi.GetFolderSize("C:\\");

result will be used size of C drive


Untitled Document

The WinApi.GetCurrDisplaySettings function returns current diplay settings

table WinApi.GetCurrDisplaySettings();

Parameters

this function has no parameters

Return Values

If the function succeeds, the return value is a Table.

dpsTable = WinApi.GetCurrDisplaySettings();

number dpsTable.Width
number dpsTable.Height
number dpsTable.Bits
number dpsTable.Frequency

If the function fails,the return value is nil.

if ( dpsTable == nil) then

--Error

end


Untitled Document

The WinApi.EnumDisplaySettings function enumeartes available display settings (supported by display device).

table WinApi.EnumDisplaySettings();

Parameters

this function has no parameters

Return Values

rTable = WinApi.EnumDisplaySettings();

If the function succeeds, the return value is a Table

rTable[n] = "width|height|bits|frequency";

rTable[1] = "640|480|16|6";
rTable[2] = "800|600|16|6";
rTable[3] = "1024|768|16|6";
rTable[n] = "n|n|n|n";
.
.

you can use WinApi.DelimitedStringToTable(); function to delimite this values

If the function fails, the return value is nil

you can determine error:

if (rTable == nil) then

--Error

end


Untitled Document

The WinApi.ChooseFont function opens standart system ChooseFont dialog and returns a table

table WinApi.ChooseFont();

Parameters

this function has no parameters

Return Values

If the function succeeds, the return value is a Table.

fontTable = WinApi.ChooseFont();

string fontTable.Font
number fontTable.Size
boolean fontTable.Bold
boolean fontTable.Italic
boolean fontTable.Underline
boolean fontTable.StrikeOut
number fontTable.Dec --font color
string fontTable.Hex --font color
number fontTable.Red --font color
number fontTable.Green --font color
number fontTable.Blue --font color

If the function fails, or user presses (ESC,CANCEL,CLOSE) the return value is "CANCEL".


Untitled Document

The WinApi.ChooseColor function opens standart system ChooseColor dialog and returns a table

table WinApi.ChooseColor();

Parameters

this function has no parameters

Return Values

If the function succeeds, the return value is a Table.

clrTable = WinApi.ChooseColor();

number clrTable.Dec
string clrTable.Hex
number clrTable.Red
number clrTable.Green
number clrTable.Blue

If the function fails, or user presses (ESC,CANCEL,CLOSE) the return value is "CANCEL".


Untitled Document

The WinApi.BlockInput function blocks keyboard and mouse input events from reaching applications.

boolean WinApi.BlockInput(
boolean fBlockIt
);

Parameters

fBlockIt
Specifies the function's purpose. If this parameter is TRUE, keyboard and mouse input events are blocked. If this parameter is FALSE, keyboard and mouse events are unblocked. Note that only the thread that blocked input can successfully unblock input.

Return Value

If the function succeeds, the return value is TRUE.

If input is already blocked, the return value is FALSE.

Remarks

The system will unblock input in the following cases:

  • The thread that blocked input unexpectedly exits without calling BlockInput with fBlock set to FALSE. In this case, the system cleans up properly and re-enables input.
  • Windows 95/98/Me: The system displays the Close Program/Fault dialog box. This can occur if the thread faults or if the user presses CTRL+ALT+DEL.
  • Windows 2000/XP: The user presses CTRL+ALT+DEL or the system invokes the Hard System Error modal message box (for example, when a program faults or a device fails).


Untitled Document

The WinApi.RecycleBinDelete function deletes an item from recyclebin

boolean WinApi.RecycleBinDelete(
number ItemId --Item id
);

Parameters

ItemId

Specifies the id of item.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.

Remarks:

A confirmation dialog will be showed when you call this function


Untitled Document

The WinApi.RecycleBinEnumerate function enumerates files/folders that are stored by the recyclebin

table WinApi.RecycleBinEnumerate();

Parameters

this function has no parameters

Return Values

A numerically indexed table containing the informations of the items in recyclebin (in delimited string form with "|" delimiter).

rTable = WinApi.RecycleBinEnumerate();

rTable[n] = "ItemId|Name|Original Location|Date Of Delete|Size|Type|Owner";

ItemId : Specifies the id number of the item you will need to this when you want to delete restore ... an item
Name : Specifies the item name, if item is a file "FileName.ext" else if item is a folder "FolderName"
Original Location : Specifies the original location of item, when you restore an item that will be moved to this path
Date Of Delete : Specifies the date of delete this value will be in local calendar format Example: 23.03.2008 17:46
Size : Specifies the size of item in KB Example: 22.245 KB
Type : Specifies the simple description of item Example: HTML Document
Owner : Specifies the owner of item ( MachineName\UserName) Example: SERKAN-EC153A1D\Serkan

you can use WinApi.DelimitedStringToTable(); function to delimite this values

If the function fails, the return value is nil

you can determine error:

if (rTable == nil) then

--Error

end


Untitled Document

The WinApi.RecycleBinRestore function restores an item from recyclebin to its original location

boolean WinApi.RecycleBinRestore(
number ItemId --Item id
);

Parameters

ItemId

Specifies the id of item.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.RecycleBinPutFile function moves a file to recycle bin

boolean WinApi.RecycleBinPutFile(
string lpFile --path of file
);

Parameters

lpFile

Identifies the file to be moved to recycle bin (Full Path Required)

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.RecycleBinGetInfo function returns total size and Items of the system recycle bin.

table WinApi.RecycleBinGetInfo();

Parameters

this function has no parameters

Return Values

If the function succeeds, the return value is a Table.

rbTable = WinApi.RecycleBinGetInfo();

number rbTable.Size -- in bytes
number rbTable.Items

If the function fails, the return value is nil.

if ( rbTable == nil) then

--Error

end


Untitled Document

The WinApi.RecycleBinEmpty function empties the recycle bin

boolean WinApi.RecycleBinEmpty(
boolean Conf, --confirmation dialog
boolean Prog, --progress dialog
boolean Sound --sound
);

Parameters

Conf

if this parameter is false , No dialog box confirming the deletion of the objects will be displayed

Prog

if this parameter is false , No dialog box indicating the progress will be displayed.

Sound

if this parameter is false ,No sound will be played when the operation is complete.

Return Values

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.


Untitled Document

The WinApi.GetDlgCtrlID function returns the identifier of the specified control.

number WinApi.GetDlgCtrlID(

number hWnd --handle of control
);

Parameters

hWnd

Identifies the control.

Return Values

If the function succeeds, the return value is the identifier of the control.
If the function fails, the return value is 0

.Remarks

WinApi.GetDlgCtrlID accepts child window handles as well as handles of controls in dialog boxes. An application sets the identifier for a child window when it creates the window by assigning the identifier value to the hmenu parameter when calling the CreateWindow or CreateWinApi.function.
Although WinApi.GetDlgCtrlID may return a value if hWnd identifies a top-level window, top-level windows cannot have identifiers and such a return value is never valid.


Untitled Document

The WinApi.GetDlgItemText function retrieves the title or text associated with a control in a dialog box.

number WinApi.GetDlgItemText(

number hDlg, -- handle of dialog box
number nIDDlgItem, --identifier of control
number nMaxCount --maximum size of string
);

Parameters

hDlg

Identifies the dialog box that contains the control.

nIDDlgItem

Specifies the identifier of the control whose title or text is to be retrieved.

nMaxCount

Specifies the maximum length, in characters, of the string to be returned

Return Values

If the function succeeds, the return value text of the control
If the function fails, the return value is nil.


Untitled Document

The WinApi.GetSysColor function retrieves the current color of the specified display element. Display elements are the parts of a window and the Windows display that appear on the system display screen.

number WinApi.GetSysColor(
number nIndex --index
);

Parameters

nIndex

Specifies the display element whose color is to be retrieved. This parameter must be one of the following values

COLOR_3DDKSHADOW

Dark shadow for three-dimensional display elements.

COLOR_3DFACE, COLOR_BTNFACE

Face color for three-dimensional display elements.

COLOR_3DHILIGHT, COLOR_3DHIGHLIGHT, COLOR_BTNHILIGHT, COLOR_BTNHIGHLIGHT

Highlight color for three-dimensional display elements (for edges facing the light source.)

COLOR_3DLIGHT

Light color for three-dimensional display elements (for edges facing the light source.)

COLOR_3DSHADOW, COLOR_BTNSHADOW

Shadow color for three-dimensional display elements (for edges facing away from the light source).

COLOR_ACTIVEBORDER

Active window border.

COLOR_ACTIVECAPTION

Active window caption.

COLOR_APPWORKSPACE

Background color of multiple document interface (MDI) applications.

COLOR_BACKGROUND, COLOR_DESKTOP

Desktop.

COLOR_BTNTEXT

Text on push buttons.

COLOR_CAPTIONTEXT

Text in caption, size box, and scroll bar arrow box.

COLOR_GRAYTEXT

Grayed (disabled) text. This color is set to 0 if the current display driver does not support a solid gray color.

COLOR_HIGHLIGHT

Item(s) selected in a control.

COLOR_HIGHLIGHTTEXT

Text of item(s) selected in a control.

COLOR_INACTIVEBORDER

Inactive window border.

COLOR_INACTIVECAPTION

Inactive window caption.

COLOR_INACTIVECAPTIONTEXT

Color of text in an inactive caption.

COLOR_INFOBK

Background color for tooltip controls.

COLOR_INFOTEXT

Text color for tooltip controls.

COLOR_MENU

Menu background.

COLOR_MENUTEXT

Text in menus.

COLOR_SCROLLBAR

Scroll bar gray area.

COLOR_WINDOW

Window background.

COLOR_WINDOWFRAME

Window frame.

COLOR_WINDOWTEXT

Text in windows.

Return Values

If the function succeeds, the return value is decimal color value for specified index
If the function fails, the return value is -1.


Untitled Document

The WinApi.GetWindowRect function retrieves the dimensions and state of task bar

table WinApi.GetTaskBar();

Parameters

this function has no parameter .

Return Values

If the function succeeds, the return value is table containing bounding rectangle and state of task bar

result = WinApi.GetTaskBar();

result.X;
result.Y;
result.Width;
result.Height;
result.State; Can be one of following "LEFT","RIGHT","TOP","BOTTOM","HIDDEN"

If the function fails, the return value is nil

if (result ~= nil) then
--do anything here
end