Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make my app "alwais on top" !

Status
Not open for further replies.

Bogdan81

Programmer
Oct 2, 2002
11
RO
I'm creating an app that needs to be always on top, so the user can see some hints. How could I make my app "always on top" ?
 
For each of your forms, set the FormStyle in the form designer to fsStayOnTop.

Note that messing with this property while your app is running may have unpredictable effects -- sometimes your app may fail to stay on top -- so set it at design time. -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Thx Ronin. I manage to keep my app on top in this way :

in the OnCreate event i use
SetWindowPos(Form1.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE OR SWP_NOACTIVATE OR SWP_NOSIZE);

and in the OnPaint event
SetZOrder(True);

and i want to say that it works perfectly. What do you think ?
 
Sure. Mine is the Delphi VCL way; yours is the Windows API way.

Using Delphi's Visual component library is often shorter and more readable; but it may not give you as much control as a Windows API call, and there are some things you just can't do through the VCL, which means that you've got no choice but to go through the Windows API.

Windows API calls are portable to other languages under Windows (e.g., Visual Basic, C++, whatever), but Delphi VCL objects, methods etc. are more likely to be easily portable to Kylix. But in the here'n'now, if it works for you, it's good. -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top