El Don wrote:
what I'm asking for is a form on top of everything, not stealing focus, and if she presses a key, for example "q", the message activates no matter what she is doing. I'm a beginner, and I know how to do the label, the key press, but I don't know how to do the above mentioned, if anyone can help me, I'll be very grateful.
Well to make a Form stay on top of other Forms you need to use a bit of API coding. It maybe easier to put this code into a Module then it can be called from any Form.
Code:
Option Explicit
Public 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 Sub FormOnTop(Handle As Long, OnTop As Boolean)
Dim wFlags As Long
Dim PosFlag As Long
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const SWP_SHOWWINDOW = &H40
Const SWP_NOACTIVATE = &H10
Const HWND_NOTOPMOST = -2
Const HWND_TOPMOST = -1
wFlags = SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW Or SWP_NOACTIVATE
Select Case OnTop
Case True
PosFlag = HWND_TOPMOST
Case False
PosFlag = HWND_NOTOPMOST
End Select
SetWindowPos Handle, PosFlag, 0, 0, 0, 0, wFlags
End Sub
Now which ever Form you want to stay on top you just add this line into the Form_Load()
Code:
Private Sub Form_Load()
Call FormOnTop(Me.hwnd, True)
End Sub
True is on top and False is not.
