Hallo!
Wie kann ich einer Form ein „Attribut“ zuweisen, sodass sie immer im Hintergrund ist?
Konkret: Mein Programm, ein Terminplaner, soll direkt auf dem Desktop liegen und muss immer das unterste Programm sein; es soll nämlich so wirken, als wäre es in den Desktopbereich fest integriert.
Irgendwo hab ich einen entsprechenden Code gefunden, der Code macht aber gar nix; Fehler bei Compilieren gibt es nicht, aber er macht eben nix…
Schon mal vielen Dank falls mir da jemand weiterhelfen kann,
Nina
Option Explicit
Private Const HWND_TOP = 0
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Declare Function SetWindowPos Lib „User32“ (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Sub Form_Load()
Call StayNotOnTop(Form1)
End Sub
Sub StayNotOnTop(the As Form)
Call SetWindowPos(the.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
End Sub