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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can my Window application always "on top"?

Status
Not open for further replies.

johnsunbill

Programmer
Jun 5, 2003
3
VN
Dear all,

I would like to write some codes in my Window application to let it alsway on "TOP" and will not be killed by Ctrl+Alt+Del. It means that nobody can use other application except they close my application. This will help me to prevent our operators only work with my application. I'm using PB version 5.

Thanks in advance for your advice.

Regards,

John
 
hi,

try using SetPosition() function for the frame window .
framewindow.SetPosition(TopMost!).


the other way would be to use an external function like
SetWindowPos(long hwnd, long hmode, int ix, int iy, int cx,
int cy, ulong flags) LIBRARY "USER32.DLL"

HTH
Regards
 
Hi Sajuks,

Thanks for your help. It works with SetPosition(topMost!). My frame window always on top!
However, can we disable Ctrl+Alt+Del? Otherwise it's easy to kill my application?

Thanks again,
Regards,
John
 
You might try adding code to the application close event. I would suggest that you create a window to take some input (say a secret password), call the window in the app close event, pass the data from the window back to the close event, and validate it so that you can actually close that app. If it doesn't validate, set the Return code so that the app doesn't close.

If that doesn't work, then there are Windows API calls that you can probably use, but it will get very involved and quite time consuming.

Good Luck, and let us know what solution you come up with.

Rob
 
Hi Rob,

Thanks for your tips. I created a "response" window and called it in application close query event and check the password before closing my application. However, Ctrl+Alt+Del still can kill my appalication.
So it seems to me that "call APIs" must be the only way to meet my requirement.
Could you please share with me the API name and show me how we call them in PB to take the control of system function keys, for example: "Ctrl+Esc"and "Ctrl+Alt+Del"

Bests,

John
 
John,

I don't know the API calls you need. I suggest you start your search at msdn.microsft.com/library. Drill down in the menus on the left - Windows Development | Windows API.

Sorry I can't help more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top