I found this function that works nicely on the on click event of a button. It keeps the form On top of all other applications.
The Function;
I call it from here;
I want a button that disables this function as well so that if the user wants to go back to having other apps on top they could press that button. Right now the form has to be closed and then reopened. This has to be simple, I tried cancel, delete, etc.
Can anyone help? Thanks in advance.
The Function;
Code:
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
Public Const HWND_TOPMOST = -1
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Function TopMost(F As Form)
Call SetWindowPos(F.hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOMOVE Or SWP_NOSIZE)
End Function
I call it from here;
Code:
Private Sub OnTopCommand_Click()
Call TopMost([Form])
End Sub
I want a button that disables this function as well so that if the user wants to go back to having other apps on top they could press that button. Right now the form has to be closed and then reopened. This has to be simple, I tried cancel, delete, etc.
Can anyone help? Thanks in advance.