Sets the size and position of either the main Help window or a secondary window.
Syntax
PositionWindow(x-coord, y-coord, width, height, window-state, "window-name")
PW(x-coord, y-coord, width, height, window-state, "window-name")
Parameter | Description |
x-coord | X-coordinate, in Help units, of the upper-left window corner. Positions are defined in terms of Windows Help’s 1024-by-1024 coordinate system, regardless of screen resolution. For example, if the x-coordinate is 512, the left edge of the Help window is in the middle of the screen. (For more information about determining actual coordinates for different video resolutions, see “Secondary Windows” in Chapter 9, “Defining Topic Windows.”) | |||
y-coord | Y-coordinate, in Help units, of the upper-left window corner. | |||
width | Default width, in Help units, of the window. | |||
height | Default height, in Help units, of the window. | |||
window-state | Specifies the window’s state when it is displayed. This parameter is passed to the Windows ShowWindow function, which determines how the window is to be shown. The values for the ShowWindow function are explained in the following table. If the window is maximized (value=3), Windows Help ignores the x-coord, y-coord, width, and height parameters. | |||
Value | Constant | Action |
0 | SW_HIDE | Hides the window and passes activation to another window. | |
1 | SW_SHOWNORMAL | Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position (same as SW_RESTORE). | |
2 | SW_SHOWMINIMIZED | Activates a window and displays it as an icon. | |
3 | SW_SHOWMAXIMIZED | Activates a window and displays it as a maximized window. | |
4 | SW_SHOWNOACTIVATE | Displays a window in its most recent size and position. The window that is currently active remains active. | |
5 | SW_SHOW | Activates a window and displays it in its current size and position. | |
6 | SW_MINIMIZE | Minimizes the specified window and activates the top-level window in the system’s list. | |
7 | SW_SHOWMINNOACTIVE | Displays a window as an icon. The window that is currently active remains active. | |
8 | SW_SHOWNA | Displays a window in its current state. The window that is currently active remains active. | |
9 | SW_RESTORE | Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position (same as SW_SHOWNORMAL). |
window-name | Name of the window to position. The name “main” is reserved for the primary Help window. Secondary window names are defined in the [WINDOWS] section of the Help project file. This name must be enclosed in quotation marks. |
Example
The following macro displays and positions the Samples secondary window in the upper-left corner (100, 100) with a width and height of 500 in Help units:
PositionWindow(100, 100, 500, 500, 5, "Samples")
Comments
If the window to be positioned does not exist, Windows Help ignores the macro.
Microsoft does not guarantee platform independence for the ShowWindow function because the values are Windows constants. Therefore, they may change on other platforms.
See Also
CloseWindow, FocusWindow