Windows
Dynamic positioning windows
- Demonstration
- Functionality:
- Create an application with 2 windows:
- The main window:
- it has a caption (title) bar
- it is resizable (including minimizing and maximizing) with a standard border
- the background colour of the client area is standard
- it is placed above all non-topmost windows
- it is visible on the taskbar and in the alt-tab switching window
- closing it, ends the application
- The transparent window:
- it has no caption (title) bar
- it has no border
- the colour of the window is the same as a colour defined in the system for the caption
bar for active windows
- it is semitransparent (with the alpha parameter set to 50%)
- it is placed above all non-topmost windows
- it is invisible on the taskbar and in the window of the alt-tab switching
- size and position:
- if there is no foreground window or the foreground window is the main or the
transparent window of this aplication, the transparent window takes a quarter of the screen
- in other cases, it takes a quarter of the foreground window
- the taken quarter depends on the position of the centre point of the
main window - if it is placed in the left-top quarter of the screen, the transparent
window takes the left-top quarter (of the screen or the foreground window), and
analogously for other quarters
- changing positioning of the transparent window can be delayed (as in the demonstration)
- it is impossible to place it above the main window in any way
- Assumptions (for simplicity):
- there is only one screen
- the size of the screen does not change during running the application
- Hints:
- GetSystemMetrics, SM_CXSCREEN, SM_CYSCREEN
- WS_EX_LAYERED, SetLayeredWindowAttributes()
- SetTimer(), WM_TIMER
- GetForegroundWindow()
- GetWindowRect()
- MoveWindow(), SetWindowPos(), BringWindowToTop()
- Approximate points:
- Features of the main window: 2.0
- Features of the transparent window:
- no caption and no border: 1.0
- colour and semitransparency: 1.0
- size and position: 5.0
- other features: 1.0