How do I make my app AlwaysOnTop?
Its easy to do it in Delphi but in VB I can't find anything to do this.
Thanx in advance for any reply.
Celery
Printable View
How do I make my app AlwaysOnTop?
Its easy to do it in Delphi but in VB I can't find anything to do this.
Thanx in advance for any reply.
Celery
Not hard, this one:
Add the following to a module:
Then add this to the Form_Load of the form you want on top (make sure you replace FORM1 with the form's name):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
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
Failing that, there are a few good AOT controls around.Code:res& = SetWindowPos(FORM1.hwnd, HWND_TOPMOST, _
0, 0, 0, 0, FLAGS)
Hope this helps...
Thanx for your reply Starsky!
But Delphi still has much easier way to do that - you just
set FormStyle to StayOnTop. I can't understand why VB can't
copy some things from Delphi (and vice versa). Programming
would be much easier for everyone!
Celery
are you serious? Delphi had the OnTop feature?
Yeah!
I had Delphi 3 and it was very easy to switch from AlwaysOnTop to Normal form style in
design- and runtime.
I really miss that in VB!