I use this proc in Win98
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowWindow(Application.Handle,SW_Hide);
//Form1.Hide;
RegisterServiceProcess(0,1);
if (RegisterServiceProcess(0,1)<>1) then
MessageDlg('Cannot hide process ',mtError,[mbOK],0);
end;
The form still can be seen from Alt+Tab. Indeed, I can hide it from Alt +
Tab by activating the
second line but I will loose my form too.Don't ask me to change the Form's
borders style to bsToolWindow.
This proc doesn't work in WinXP! How to register a service process in WinXP?
Example code will be appreciated very much.
Thanks for helping
The only way of really hiding a process will result in a virus warning, besides there is no good reasons for doing it.
---
with Regards
/Filip
There are valid reasons for it.
(I use a hidden app as a watchdog app, to trap and stop students running
games in the student computer lab).
One technique is to use the code below:
Use it in the *.dpr right before Application.Initialize
ShowWindow(Application.Handle, SW_HIDE );
SetWindowLong(Application.Handle, GWL_EXSTYLE,
GetWindowLong(Application.Handle, GWL_EXSTYLE) or
WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
If the above is not sufficient, making the app a 'Service' may work.
function RegisterServiceProcess(ProcessID, Flag: dWord):Word;
stdcall; external 'kernel32.dll';
{...}
procedure TForm1.FormCreate(Sender: TObject);
var
CurrentProccess : DWORD;
begin
// get our applications process ID
CurrentProcess := GetCurrentProcessID();
// register our process as a kernel32 process
RegisterServiceProcess(CurrentProcess, 1);
end;
--
Charles Hacker
Lecturer in Electronics and Computing
School of Engineering
Griffith University - Gold Coast
Australia
Here's a possible answer:
http://delphi.about.com/library/weekly/aa012103a.htm
.............................................
Zarko Gajic, BSCS
About Guide to Delphi Programming
http://delphi.about.com
email: delphi...@about.com
free newsletter: http://delphi.about.com/library/blnewsletter.htm
forum: http://forums.about.com/ab-delphi/start/
advertising: http://delphi.about.com/library/bladvertise.htm
.............................................
"dk" <drea...@yahoo.com.sg> wrote in message
news:3eb6...@newsgroups.borland.com...
---
with Regards
Filip Poverud