Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 13388, Make a form "really" Stay-On-Top

by James Price Email: jprice@neurotechnics.com


Download Details
FTP  download also available 0 bytes
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 3.0  to 4.0 20 downloads
Copyright: Commercial use requires permission


Size: 0 bytes
Updated on Sun, 30 May 1999 00:00:00 GMT
Originally uploaded on Sun, 30 May 1999 00:00:00 GMT
Description
Ever wanted to make a form StayOnTop of every program running on your maachine instead of just your application.....
This example uses the WinAPI function
SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND; X, Y, cx, cy: Integer; uFlags: UINT): BOOL;

begin
with Form1 do
SetWindowPos(Handle, HWND_TOPMOST, Left, Top, Width, Height,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
end;

To deactivate the "StayOnTop" setting, use the HWND_NOTOPMOST value in the same function....

begin
with Form1 do
SetWindowPos(Handle, HWND_NOTOPMOST, Left, Top, Width, Height,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
end;

NOTE:
The variables for Left, Right etc are used to determine the forms new size and position after the SetWindowPos has executed.
SWP_NOACTIVATE The form will not be activated (e.g. if running in the background)
SWP_NOMOVE Retains the current position (ignores the X and Y parameters)
SWP_NOSIZE Retains the current size (ignores the cx and cy parameters)

Server Response from: ETNACDC03