Click to See Complete Forum and Search --> : ontop


ps71
January 27th, 2000, 01:59 PM
hello!!
how can my program be always ontop.

AndyK
January 27th, 2000, 02:17 PM
1) Make 2 command buttons (Command1, Command2)
place this code into form

private Declare Function SetWindowPos Lib "user32" (byval h%, byval hb%, byval X%, byval Y%, byval cx%, byval cy%, byval F%) as Integer
Const flags = SWP_NOMOVE Or SWP_NOSIZE
Const SWP_NOMOVE = 2
Const SWP_NOSIZE = 1
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
private Sub Command1_Click()
SetWindowPos me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags
End Sub

private Sub Command2_Click()
SetWindowPos me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, flags
End Sub



Clicking Command1 will activate "on top"
Clicking Command2 will remove "on top"