Package Win32::GUI

Back to the Packages


Methods

ArrangeIconicWindows()

Arranges all the minimized child windows of the specified parent window.

AttachThreadInput(FROM, TO, [FLAG])

[TBD]

BringWindowToTop()

Brings the window to the foreground.

Caption([TEXT])

See Text().

Change(HANDLE, %OPTIONS)

Change most of the options used when the object was created.

ChangeCursor(CURSOR)

Changes the default cursor for a window to CURSOR (a Win32::GUI::Cursor object). Returns the handle of the previous default cursor.

ChangeIcon(ICON)

Changes the default icon for a window to ICON (a Win32::GUI::Icon object). Returns the handle of the previous default icon.

ChangeSmallIcon(ICON)

Changes the default small icon for a window to ICON (a Win32::GUI::Icon object). Returns the handle of the previous default small icon.

ChooseColor(%OPTIONS)

Allowed %OPTIONS are:

 -owner
 -color

ChooseFont(%OPTIONS)

Allowed %OPTIONS are:

 -owner
 -size
 -height
 -width
 -escapement
 -orientation
 -weight
 -bold
 -italic
 -underline
 -strikeout
 -charset
 -outputprecision
 -clipprecision
 -quality
 -family
 -name
 -face (== -name)
 -color
 -ttonly
 -fixedonly
 -effects
 -script
 -minsize
 -maxsize

CloseEnhMetaFile()

[TBD]

CloseWindow()

Minimizes a window.

CommDlgExtendedError()

Returns the common dialog library error code.

CreateEnhMetaFile(FILENAME, [DESCRIPTION])

[TBD]

DeleteEnhMetaFile(HANDLE)

[TBD]

Dialog()

Enter the GUI dialog phase: the script halts, the user can interact with the created windows and events subroutines are triggered as necessary; note that this function must be called without ANY parameter or instantiation (eg. don't call it as method of a created object):

    Win32::GUI::Dialog(); # correct
    $Window->Dialog();    # !!!WRONG!!!

Disable()

Disables a window.

DrawMenuBar()

Forces redrawing of the menu bar.

Enable([FLAG])

Enables a window (or disables it if FLAG is FALSE).

FindWindow(CLASSNAME, WINDOWNAME)

Returns the handle of the window whose class name and window name match the specified strings; both strings can be empty. Note that the function does not search child windows, only top level windows. If no matching windows is found, the return value is zero.

GetActiveWindow()

Returns the handle of the active window.

GetClassName()

Returns the classname of the specified window (undef on errors). See new Win32::GUI::Class.

GetClientRect()

Returns a four elements array defining the windows client area rectangle (left, top, right, bottom) or undef on errors.

GetCursor()

Returns the handle of the current cursor.

GetCursorPos()

Returns a two elements array containing the x and y position of the cursor, or undef on errors.

GetDesktopWindow()

Returns the handle of the desktop window.

GetDlgItem(ID)

Returns the handle of a control in the dialog box given its ID.

GetEffectiveClientRect(HANDLE, ID)

[TBD]

GetFocus()

Returns the handle of the window that has the keyboard focus.

GetFont(FONT)

Gets the font of the window (returns an handle; use

  $Font = $W->GetFont();
  %details = Win32::GUI::Font::Info( $Font );

to get font details).

GetFontName()

Returns the name of the font used in the window.

GetForegroundWindow()

Returns the handle of the foreground window.

GetMenu()

Returns the handle of the menu associated with the window.

GetMessage([MIN, MAX])

Retrieves a message sent to the window, optionally considering only messages identifiers in the range MIN..MAX; if a message is found, the function returns a 7 elements array containing:

  - the result code of the message
  - the message identifier
  - the wParam argument
  - the lParam argument
  - the time when message occurred
  - the x coordinate at which message occurred
  - the y coordinate at which message occurred

If the result code of the message was -1 the function returns undef. Note that this function should not be normally used unless you know very well what you're doing.

GetOpenFileName(%OPTIONS)

Allowed %OPTIONS are:

 -owner => WINDOW
     [TBD]
 -title => STRING
     the title for the dialog
 -directory => STRING
     specifies the initial directory
 -file => STRING
     specifies a name that will appear on the dialog's edit field
 -filter => ARRAY REFERENCE
     [TBD]

GetPerlWindow()

Returns the handle of the DOS Prompt window your perl script is running in; if called in an array context, returns the handle and the HINSTANCE of your perl process.

GetStockObject(OBJECT)

Returns the handle of the specified predefined system object (pen, brush or font). OBJECT can have one of the following values:

   0 WHITE_BRUSH
   1 GRAY_BRUSH
   2 LTGRAY_BRUSH
   3 DKGRAY_BRUSH
   4 BLACK_BRUSH
   5 NULL_BRUSH (also HOLLOW_BRUSH)
   6 WHITE_PEN
   7 BLACK_PEN
   8 NULL_PEN
  10 OEM_FIXED_FONT
  11 ANSI_FIXED_FONT
  12 ANSI_VAR_FONT
  13 SYSTEM_FONT
  14 DEVICE_DEFAULT_FONT
  15 DEFAULT_PALETTE
  16 SYSTEM_FIXED_FONT
  17 DEFAULT_GUI_FONT

The returned handle can be referenced as if it was a Win32::GUI object (eg. a Win32::GUI::Brush or Win32::GUI::Font), but note that it is not blessed, so you can't directly invoke methods on it:

    $Font = Win32::GUI::GetStockObject(17);    # DEFAULT_GUI_FONT
    print $Font->GetMetrics();                 # !!!WRONG!!!
    print Win32::GUI::Font::GetMetrics($Font); # correct
    $Window->SetFont($Font);                   # correct

GetSystemMetrics(INDEX)

[TBD]

GetTextExtentPoint32([FONT], STRING)

Returns a two elements array containing the x and y size of the specified text in the window (eventually with the speficied FONT), or undef on errors.

GetTopWindow()

Returns the handle of the foreground window.

GetWindow(COMMAND)

Returns handle of the window that has the specified relationship (given by COMMAND) with the specified window. Available COMMANDs are:

  GW_CHILD
  GW_HWNDFIRST
  GW_HWNDLAST
  GW_HWNDNEXT
  GW_HWNDPREV
  GW_OWNER

Example:

    $Button->GetWindow(GW_OWNER);

GetWindowLong(INDEX)

Retrieves a windows property; for more info consult the original API documentation.

GetWindowRect()

Returns a four elements array defining the windows rectangle (left, top, right, bottom) or undef on errors.

GetWindowThreadProcessId()

Returns a two elements array containing the thread and the process identifier for the specified window.

Height([HEIGHT])

Gets or sets the window height.

Hide()

Hides a window.

InvalidateRect(...)

Forces a refresh of a window, or a rectangle of it. The parameters can be (FLAG) for the whole area of the window, or (LEFT, TOP, RIGHT, BOTTOM, [FLAG]) to specify a rectangle. If the FLAG parameter is set to TRUE, the background is erased before the window is refreshed (this is the default).

IsEnabled()

Returns TRUE if the window is enabled, FALSE otherwise.

IsIconic()

Returns TRUE if the window is minimized, FALSE otherwise.

IsVisible()

Returns TRUE if the window is visible, FALSE otherwise.

IsWindow()

Returns TRUE if the window is a window, FALSE otherwise.

IsZoomed()

Returns TRUE if the window is maximized, FALSE otherwise.

Left([LEFT])

Gets or sets the window x coordinate.

Maximize()

Maximizes a window.

MessageBox([HANDLE], TEXT, [CAPTION], [TYPE])

[TBD]

Minimize()

See CloseWindow().

Move(X, Y)

Moves the window to the specified position.

OpenIcon()

Restores a minimized window.

PeekMessage([MIN, MAX, MESSAGE])

Inspects the window's message queue and eventually returns data about the message it contains; it can optionally check only for message identifiers in the range MIN..MAX; the last MESSAGE parameter, if specified, must be an array reference. If a message is found, the function puts in that array 7 elements containing:

  - the handle of the window to which the message is addressed
  - the message identifier
  - the wParam argument
  - the lParam argument
  - the time when message occurs
  - the x coordinate at which message occurs
  - the y coordinate at which message occurs

PlayEnhMetaFile(FILENAME)

[TBD]

PlayWinMetaFile(FILENAME)

[TBD]

PostMessage(MSG, WPARAM, LPARAM)

Posts a message to a window.

PostQuitMessage([EXITCODE])

Sends a quit message to a window, optionally with an EXITCODE; if no EXITCODE is given, it defaults to 0.

ReleaseCapture()

Releases the mouse capture.

Resize(X, Y)

Resizes the window to the specified dimension.

Restore()

See OpenIcon().

SaveBMP(handle)

(preliminary) Saves the window content to a BMP file.

ScaleHeight()

Returns the windows client area height.

ScaleWidth()

Returns the windows client area width.

SendMessage(MSG, WPARAM, LPARAM)

Sends a message to a window.

SendMessageTimeout(MSG, WPARAM, LPARAM, [FLAGS], TIMEOUT)

Sends a message to a window and wait for it to be processed or until the specified TIMEOUT (number of milliseconds) elapses; returns the result code of the processed message or undef on errors. If undef is returned and a call to Win32::GetLastError() returns 0, then the window timed out processing the message. The FLAGS parameter is optional, possible values are:

 0 SMTO_NORMAL
   (the calling thread can process other requests while waiting;
   this is the default setting)
 1 SMTO_BLOCK
   (the calling thread does not process other requests)
 2 SMTO_ABORTIFHUNG
   (returns without waiting if the receiving process seems to be "hung")

SetCapture()

Assigns the mouse capture to a window.

SetCursor(CURSOR)

Draws the specified CURSOR (a Win32::GUI::Cursor object). Returns the handle of the previously displayed cursor. Note that the cursor will change back to the default one as soon as the mouse moves or a system command is performed. To change the cursor stablily, see ChangeCursor().

SetFocus()

Activates a window.

SetFont(FONT)

Sets the font of the window (FONT is a Win32::GUI::Font object).

SetForegroundWindow()

Brings the window to the foreground.

SetIcon(ICON, [TYPE])

Sets the icon of the window; TYPE can be 0 for the small icon, 1 for the big icon. Default is the same icon for small and big.

SetMenu(MENU)

Associates the specified MENU to a window.

SetRedraw(FLAG)

Determines if a window is automatically redrawn when its content changes. FLAG can be a true value to allow redraw, false to prevent it.

SetWindowLong(INDEX, VALUE)

Sets a windows property; for more info consult the original API documentation.

Show([COMMAND])

Shows a window (or change its showing state to COMMAND); available COMMANDs are:

  SW_HIDE
  SW_MAXIMIZE
  SW_MINIMIZE
  SW_RESTORE
  SW_SHOW
  SW_SHOWDEFAULT
  SW_SHOWMAXIMIZED
  SW_SHOWMINIMIZED
  SW_SHOWMINNOACTIVE
  SW_SHOWNA
  SW_SHOWNOACTIVATE
  SW_SHOWNORMAL

The default COMMAND, if none specified, is SW_SHOWNORMAL.

Text([TEXT])

Gets or sets the text of a window.

Top([TOP])

Gets or sets the window y coordinate.

TrackPopupMenu(MENU, X, Y, [FLAGS])

[TBD]

Update()

Refreshes the content of a window.

Version()

Returns the module version number.

Width([WIDTH])

Gets or sets the window width.

WindowFromPoint(X, Y)

Returns the handle of the window at the specified screen position.