d4jaj1
asked on
Hide Application from TaskList/Bar
Hello,
I'm calling a form in a DLL in which I want teh user to actually close before they can continue work in the forms in the EXE - sort of like showmodal. I don't want the user to be able to either 1) press Alt+Tab or 2) click the exe form in the TaskBar to switch back to the application while the DLL form is still open. I also DO NOT want to hide the exe form from the screen, just from the tasklist & taskbar. I will also need to restore the taskbar icon & tasklist entries of the exe after the DLL form is closed. I've tried a few differnt API calls that I got from a newsgroup, but none of them worked. If you provide an API call, please add the correct syntax.
Thanks
I'm calling a form in a DLL in which I want teh user to actually close before they can continue work in the forms in the EXE - sort of like showmodal. I don't want the user to be able to either 1) press Alt+Tab or 2) click the exe form in the TaskBar to switch back to the application while the DLL form is still open. I also DO NOT want to hide the exe form from the screen, just from the tasklist & taskbar. I will also need to restore the taskbar icon & tasklist entries of the exe after the DLL form is closed. I've tried a few differnt API calls that I got from a newsgroup, but none of them worked. If you provide an API call, please add the correct syntax.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yea, I need more. I'm not trying to hide the application, just remove the taskbar/tasklist entries - so SW_HIDE won't work. Also, I have no idea how to use the GetNumTasks API call to hide a to hide the application's icons once found. Code examples?
The only way to hide the application from the taskbar is to use showwindow
to hide it from the task list I used this code snippet
pass the const fisrt
const
RSP_SIMPLE_SERVICE = 1;
then create the function
function RegisterServiceProcess(Pro cessID, Flag: dWord):Word;
stdcall; external 'kernel32.dll';
then call the function
RegisterServiceProcess(Get CurrentPro cessID, RSP_SIMPLE_SERVICE);
Later
BoRiS
to hide it from the task list I used this code snippet
pass the const fisrt
const
RSP_SIMPLE_SERVICE = 1;
then create the function
function RegisterServiceProcess(Pro
stdcall; external 'kernel32.dll';
then call the function
RegisterServiceProcess(Get
Later
BoRiS
If I am not wrong, the only thing you want to do is, to make the main form activated
after the dll form is closed. otherwise make it impossible to activate the main form.
this is the DLL code;
DLL Project Source::
//**************DLL PROJECT SOURCE*************
library dllp;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
View-Project Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the DELPHIMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using DELPHIMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes,
dll in 'dll.pas' {Form1};
exports
CreateForminDll;
end.
//********THIS IS THE UNIT INCLUDED IN THE DLL*********************** ****
unit dll;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Procedure CreateFormInDll;stdcall;
implementation
{$R *.DFM}
Procedure CreateFormInDll;stdcall;
Begin
Form1:= TForm1.Create(Application) ;
Form1.ShowModal;
End;
procedure TForm1.Button1Click(Sender : TObject);
begin
Form1.Close;
end;
end.
As you can see in the above code portions. I have included a form into dll project that consists of a label and a button.
//**********THIS IS THE UNIT OF THE CALLING PROGRAM*********
unit formdll1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
Procedure CreateFormInDll;stdcall; external 'h:\experts\formdll\dllp.d ll'; // THIS PATH //AND DLL NAME MUST BE CHANGED..
{$R *.DFM}
procedure TForm1.Button1Click(Sender : TObject);
begin
CreateFormInDll; // Call to the exported function defined in the DLL, to show the //form in DLL
end;
end.
Unless the user press the button on the Dll's form, the calling program window cannot
be activated by clicking or by using the alt+tab .
after the dll form is closed. otherwise make it impossible to activate the main form.
this is the DLL code;
DLL Project Source::
//**************DLL PROJECT SOURCE*************
library dllp;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
View-Project Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the DELPHIMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using DELPHIMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes,
dll in 'dll.pas' {Form1};
exports
CreateForminDll;
end.
//********THIS IS THE UNIT INCLUDED IN THE DLL***********************
unit dll;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Procedure CreateFormInDll;stdcall;
implementation
{$R *.DFM}
Procedure CreateFormInDll;stdcall;
Begin
Form1:= TForm1.Create(Application)
Form1.ShowModal;
End;
procedure TForm1.Button1Click(Sender
begin
Form1.Close;
end;
end.
As you can see in the above code portions. I have included a form into dll project that consists of a label and a button.
//**********THIS IS THE UNIT OF THE CALLING PROGRAM*********
unit formdll1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
Procedure CreateFormInDll;stdcall; external 'h:\experts\formdll\dllp.d
{$R *.DFM}
procedure TForm1.Button1Click(Sender
begin
CreateFormInDll; // Call to the exported function defined in the DLL, to show the //form in DLL
end;
end.
Unless the user press the button on the Dll's form, the calling program window cannot
be activated by clicking or by using the alt+tab .
https://www.experts-exchange.com/topics/comp/lang/delphi/Q.10053466