I have the following situation: I have a project, which calls a DLL and it has a form. Until that moment 'OK', it performs the call and displays the form, only one thing that bothers me visually is that the system tray has two open applications, one from the project and the other from the DLL.
Opening the form in ShowModal
, and pressing ctrl + tab for the project, it gives focus but I can not access anything.
My question is how to leave only one application in the system tray.
DLL encoding
library ChamadaForm;
uses
SysUtils,
Forms,
Classes;
{$R *.res}
procedure exibir; stdcall;
var
frm : TForm;
begin
frm := TForm.Create(nil);
frm.ShowModal;
freeAndNil(frm);
end;
exports
exibir;
begin
end.
Calling the DLL in the Project.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, 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
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
exibir : procedure; stdcall;
handle: THandle;
begin
handle := LoadLibrary('ChamadaForm.dll');
if Handle <> 0 then
begin
@exibir := GetProcAddress (Handle, 'exibir');
if @exibir <> nil then
exibir;
FreeLibrary (Handle);
end;
end;
end.