How to Create a Topmost or Floating Window in Visual BasicID: Q84251
|
You can create a "floating" window such as that used for the Microsoft Windows version 3.1 Clock by using the SetWindowPos Windows API call.
A floating (or Topmost) window is a window that remains constantly
above all other windows, even when it is not active. Examples of
floating windows are the Find dialog box in WRITE.EXE, and CLOCK.EXE
(when Always on Top is selected from the Control menu).
For more information on this topic, please see the following article in the
Microsoft Knowledge Base:
Q81137 : INF: How to Create a Topmost Window
Declare Function SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal
hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal
cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
' The above Declare statement must appear on one line.
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
'Put global constants in bas module.
"Page 892 of Microsoft Windows 3.1 Programmer's Reference, Volume 2, Functions,"
Additional query words: top most Win31 Float Topmost Notopmost Setwindowpos
Keywords : kbcode kbWndw
Version : WINDOWS:1.0,2.0,3.0
Platform : WINDOWS
Issue type :
Last Reviewed: May 12, 1999