?
Solved

How can I made application stay focused and on top and ...

Posted on 2003-03-23
13
Medium Priority
?
322 Views
Last Modified: 2010-04-04
Hi,

I would like to know, how can I make application to stay on top, stay focused and if in w98 nobody can terminate it fromo CTRL+ALT+DEL list. I mean something like to lock desktop :)

Thanks to all
0
Comment
Question by:asterisk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
13 Comments
 

Accepted Solution

by:
BLayman earned 200 total points
ID: 8193712
Careful with this one...
 MessageBox(0, 'All time critical apps have stopped', 'baboom', MB_OK or MB_ICONSTOP or MB_SYSTEMMODAL);
0
 

Expert Comment

by:BLayman
ID: 8193730
Actually let me explain further. A modal dialog is either task modal, application modal or system modal.  You can change the modal status of any dialog.  Task modal means that window is the only active window in the task.  application modal means that's the only active window in the application until it is closed.  System window means you the whole sytem is trapped in that window and nothing else can be accessed. Ctrl-Alt-Delete is special.  You may have to add special handling to look for a key down on the Ctrl key and then nil out that message.

In any case, that's how I'd do it.
0
 

Author Comment

by:asterisk
ID: 8194393
Thanks, but you have showed me a MessageBox, but i need something, where I can type password and check it. How can I achieve this?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Assisted Solution

by:Ratje
Ratje earned 200 total points
ID: 8194554
To prevent from showing in Win98 :

function RegisterServiceProcess (dwProcessID, dwType: DWord) : DWord;
         stdcall; external 'KERNEL32.DLL';

procedure TForm1.Button1Click(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessID,1);
  // Hide from Ctrl-Alt-Delete
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessID,0);
  // Show it
end;

Rat
0
 
LVL 1

Assisted Solution

by:saulite
saulite earned 200 total points
ID: 8196661
I currently don't remember, but this was done by calling some API, that is used by screen-saver. Something like ScreenSaverMode(1). Try search in Win32 Developers references (i currently don't have one).

Under win98, when screen-saver is activated, no Ctrl-Alt-Del, or Win combination works. This is what you wanted?

Under NT/2K/XP it will be more complicated, as i remember, you need to work with gina.dll (i haven't tried), but this would be outside topic.

Btw, Ratje, RegisterServiceProcess only hides this process from standard ctrl+alt+del list.

Oh, i found my old project - Desktop locking. i'll give you a part of source.

Here it is:

procedure TfrmMain.ScreensaverMode(const B: Boolean);
begin
  if B then begin
    {$IFNDEF DEBUG}
    SystemParametersInfo(97,1,nil,0);
    FormStyle:=fsStayOnTop;
    BorderStyle:=bsNone;
    {$ENDIF}
    pnlInput.Color:=clBackground;
    Color:=clBackground;
    Left:=0;
    Top:=0;
    {$IFNDEF DEBUG}
    KillEmAll();
    Width:=screen.Width;
    Height:=screen.Height;
    {$ENDIF}
  end else begin
    SystemParametersInfo(97,0,nil,0);
    BorderStyle:=bsSingle;
    FormStyle:=fsNormal;
    pnlInput.Color:=clBtnFace;
    Color:=clBtnFace;
    {$IFNDEF DEBUG}
    Width:=pnlInput.Width;
    Height:=pnlInput.Height;
    Left:=screen.Width-Width;
    Top:=0;
    {$ENDIF}
    RunShell();
  end;
end;

it was called, at app start with True. After user & password was verified (standart TEdit on form works), it was called with False, then it launched the shell (explorer.exe), as this app was initially made as shell (in system.ini Shell=Expolorer.exe was replaced, btw here be careful this is only place in windows, where Explorer.exe is case sensitive ;-)))))). Btw, Explorer.exe runs as shell, only when it's written as Shell= in system.ini, so in RunShell, you need to write in system.ini at first Shell=Explorer.exe, then run Explorer.exe, and then write Shell=YourApp.exe

The KillEmAll is using 3-rd party unit enumstuff, for killing all applications, that shouldn't be in memory right now ;-)).

Hope, this helps.
0
 

Author Comment

by:asterisk
ID: 8196770
OH, super, I want to do a lock for w9x too :) can you send the rest of code? asterisk@wo.cz
0
 
LVL 1

Expert Comment

by:saulite
ID: 8199089
heh, this was for 9x. I didn't understood what you mean.
0
 

Author Comment

by:asterisk
ID: 8210545
I want you to send me whole the code ;) the whole application :)
0
 
LVL 1

Expert Comment

by:saulite
ID: 8212446
well, it's unfinished, and i don't have a much time right now. i visit this topic within 2 days. Btw, the app is in 3 parts. Server (no questions), Manager (latest versions trough webbrowser, using CGI and Kylix), and Client (Desktop-locking). I must go, bye.
0
 
LVL 1

Expert Comment

by:saulite
ID: 8237947
Ok, take a look at http://koyanet.lv/~atis/cm/
this source is not for compiling, you probably will need to remove large parts of it (my code is very unreadable ;-).
0
 

Expert Comment

by:CleanupPing
ID: 9316632
asterisk:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question