Advertisement
1_2002 Custom Controls/ Forms/ Menus #103996

AppOnTop

How do I get my application on top?To make your window truly topmost, use the SetWindowPos API call

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
To set Form1 as a top-most form, do the following: 

#IF WIN32 THEN
Dim lResult as Long 
lResult = SetWindowPos (me.hWnd, HWND_TOPMOST, _
0, 0, 0, 0, FLAGS) 
#ELSE '16-bit API uses a Sub, not a Function
SetWindowPos me.hWnd, HWND_TOPMOST, _
0, 0, 0, 0, FLAGS
#END IF

To turn off topmost (make the form act normal again), do the following: 

#IF WIN32 THEN
Dim lResult as Long 
lResult = SetWindowPos (me.hWnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS) 
#ELSE '16-bit API uses a Sub, not a Function
SetWindowPos me.hWnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS
#END IF

If you don't want to force a window on top, which will prevent the user from seeing below it, but simply want to move a Window to the top for the user's attention, do this:

Form1.ZOrder
Původní komentáře (3)
Obnoveno z Wayback Machine