Vista loses window position


















This parameter can be a combination of the following values. If the function fails, the return value is zero. To get extended error information, call GetLastError. As part of the Vista re-architecture, all services were moved off the interactive desktop into Session 0. If you have changed certain window data using SetWindowLong , you must call SetWindowPos for the changes to take effect. When a non-topmost window is made topmost, its owned windows are also made topmost.

Its owners, however, are not changed. When a topmost window is made non-topmost, its owners and its owned windows are also made non-topmost windows. A non-topmost window can own a topmost window, but the reverse cannot occur. Any window for example, a dialog box owned by a topmost window is itself made a topmost window, to ensure that all owned windows stay above their owner. If an application is not in the foreground, and should be in the foreground, it must call the SetForegroundWindow function.

To use SetWindowPos to bring a window to the top, the process that owns the window must have SetForegroundWindow permission. For an example, see Initializing a Dialog Box. Skip to main content. This browser is no longer supported. What I don't like is if I open a second browser window, it does NOT open in the same position as the last closed window. The same happens for folder windows. They appear to open slightly down and to the right of the window opened before it.

This is annoying because I have to keep moving my windows back into the proper position. Is there any way to stop this from happening and just have all windows open exactly where the last closed one was, even if there is already a window of that program up?

This thread is locked. You can follow the question or vote as helpful, but you cannot reply to this thread. The following topics discuss the window show state:. An active window is the top-level window of the application with which the user is currently working. To allow the user to easily identify the active window, the system places it at the top of the z-order and changes the color of its title bar and border to the system-defined active window colors.

Only a top-level window can be an active window. When the user is working with a child window, the system activates the top-level parent window associated with the child window.

Only one top-level window in the system is active at a time. An application activates a top-level window by calling the SetActiveWindow function. Although an application can activate a different top-level window at any time, to avoid confusing the user, it should do so only in response to a user action. An application uses the GetActiveWindow function to retrieve a handle to the active window.

A window can be disabled. A disabled window receives no keyboard or mouse input from the user, but it can receive messages from other windows, from other applications, and from the system. An application typically disables a window to prevent the user from using the window. For example, an application may disable a push button in a dialog box to prevent the user from choosing it. An application can enable a disabled window at any time; enabling a window restores normal input.

By default, a window is enabled when created. An application enables or disables an existing window by using the EnableWindow function. An application can determine whether a window is enabled by using the IsWindowEnabled function. When a child window is disabled, the system passes the child's mouse input messages to the parent window. The parent uses the messages to determine whether to enable the child window.

For more information, see Mouse Input. Only one window at a time can receive keyboard input; that window is said to have the keyboard focus. If an application uses the EnableWindow function to disable a keyboard-focus window, the window loses the keyboard focus in addition to being disabled. If a child window, or other descendant window, has the keyboard focus, the descendant window loses the focus when the parent window is disabled.

For more information, see Keyboard Input. A window can be either visible or hidden. The system displays a visible window on the screen. It hides a hidden window by not drawing it.

If a window is visible, the user can supply input to the window and view the window's output. If a window is hidden, it is effectively disabled. A hidden window can process messages from the system or from other windows, but it cannot process input from the user or display output. An application sets a window's visibility state when creating the window. Later, the application can change the visibility state. For example, an application may keep a new window hidden while it customizes the window's appearance.

An application can determine whether a window is visible by using the IsWindowVisible function. When an owner window is minimized, the system automatically hides the associated owned windows. Similarly, when an owner window is restored, the system automatically shows the associated owned windows.

Occasionally, an application may need to hide the owned windows without having to minimize or hide the owner. In this case, the application uses the ShowOwnedPopups function.

Hiding an owner window has no effect on the visibility state of the owned windows. When a parent window is visible, its associated child windows are also visible. Similarly, when the parent window is hidden, its child windows are also hidden. Also, a visible child window is subject to the clipping rules established by its parent-child relationship. If the window's parent window is not visible, it will also not be visible.

If the parent window moves beyond the edge of the screen, the child window also moves because a child window is drawn relative to the parent's upper left corner. By default, the system enlarges a maximized window so that it fills the screen or, in the case of a child window, the parent window's client area. Although a window's size can be set to the same size of a maximized window, a maximized window is slightly different.

The system automatically moves the window's title bar to the top of the screen or to the top of the parent window's client area.

Also, the system disables the window's sizing border and the window-positioning capability of the title bar so that the user cannot move the window by dragging the title bar. By default, the system reduces a minimized window to the size of its taskbar button and moves the minimized window to the taskbar. A restored window is a window that has been returned to its previous size and position, that is, the size it was before it was minimized or maximized.

After creating a window, an application can use the CloseWindow function to minimize the window. The ArrangeIconicWindows function arranges the icons on the desktop, or it arranges a parent window's minimized child windows in the parent window. The OpenIcon function restores a minimized window to its previous size and position. The ShowWindow function can minimize, maximize, or restore a window. It can also set the window's visibility and activation states.

The SetWindowPlacement function includes the same functionality as ShowWindow , but it can override the window's default minimized, maximized, and restored positions.

The IsZoomed and IsIconic functions determine whether a given window is maximized or minimized, respectively. The GetWindowPlacement function retrieves the minimized, maximized, and restored positions for the window, and also determines the window's show state.

The system automatically sets the size and position of a maximized window to the system-defined defaults for a maximized window. Replacing these values overrides the defaults. A window's size and position are expressed as a bounding rectangle, given in coordinates relative to the screen or the parent window. The coordinates of a top-level window are relative to the upper left corner of the screen; the coordinates of a child window are relative to the upper left corner of the parent window.

An application specifies a window's initial size and position when it creates the window, but it can change the window's size and position at any time. For more information, see Filled Shapes. If the application has created other top-level windows, the system bases the size of the new window on the size of the application's most recently created top-level window.

The minimum tracking size is the smallest window size you can produce by dragging the window's sizing border. Similarly, the maximum tracking size is the largest window size you can produce by dragging the sizing border. A window's minimum and maximum tracking sizes are set to system-defined default values when the system creates the window.

For more information, see Size and Position Messages. An application that has a window menu can change the size and position of that window by sending system commands. System commands are generated when the user chooses commands from the window menu. The following system commands affect the size and position of a window. After creating a window, an application can set the window's size or position by calling one of several different functions, including SetWindowPlacement , MoveWindow , SetWindowPos , and DeferWindowPos.

SetWindowPlacement sets a window's minimized position, maximized position, restored size and position, and show state. The MoveWindow and SetWindowPos functions are similar; both set the size or position of a single application window.

The SetWindowPos function includes a set of flags that affect the window's show state; MoveWindow does not include these flags. Use the BeginDeferWindowPos , DeferWindowPos , and EndDeferWindowPos functions to simultaneously set the position of a number of windows, including the size, position, position in the z-order, and show state.

An application can retrieve the coordinates of a window's bounding rectangle by using the GetWindowRect function. The coordinates are relative to the upper left corner of the screen, even for a child window. The ScreenToClient or MapWindowPoints function maps the screen coordinates of a child window's bounding rectangle to coordinates relative to the parent window's client area.

The GetClientRect function retrieves the coordinates of a window's client area. GetClientRect fills a RECT structure with the coordinates of the upper left and lower right corners of the client area, but the coordinates are relative to the client area itself. This means the coordinates of a client area's upper left corner are always 0,0 , and the coordinates of the lower right corner are the width and height of the client area.

The CascadeWindows function cascades the windows on the desktop or cascades the child windows of the specified parent window. The TileWindows function tiles the windows on the desktop or tiles the child windows of the specified parent window. For example, the message is sent when the user clicks Move or Size from the window menu or clicks the sizing border or title bar; the message is also sent when an application calls SetWindowPos to move or size the window.

The system uses the message to calculate the size of a window's client area and the position of the client area relative to the upper left corner of the window. A window typically passes this message to the default window procedure; however, this message can be useful in applications that customize a window's nonclient area or preserve portions of the client area when the window is sized.

For more information, see Painting and Drawing. You can produce special effects when showing or hiding windows by using the AnimateWindow function. When the window is animated in this manner, the system will either roll, slide, or fade the window, depending on the flags you specify in a call to AnimateWindow. By default, the system uses roll animation. With this effect, the window appears to roll open showing the window or roll closed hiding the window.



0コメント

  • 1000 / 1000