LSS的程序看过了,是利用了DLL,想了想,又看了看李颖的帖子.
自己做了一个.
其实不用DLL一样可以实现,还是我自己来终结这个论点吧.
只要把窗体的Owner设为Desktop就行了,如果要象Outlook那样的话
再动态修改一下application.mainform(Read only不过我曾看到一篇
Tip给出了动态修改的方法,当时没注意,等会儿再开个论题讨论一下,
一定是可以的)
我做的程序原码如下(其实就是重载了CreateParams(Params))
程序如果加一个参数'1'运行的话,就显示Form2否则显示Form1,这是模拟
的Outlook点激Mailto只显示邮件编辑窗口.
....哎...可惜不能给自己加分!!!
------Project.dpr----
program Project2;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
application.showmainform:=false;
if paramcount=0 then
begin
form1.show;
end
else
begin
if paramstr(1)='1' then
begin
form2.show;
end;
end;
Application.Run;
end.
-----Unit1.pas------
unit Unit1;
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
uses Unit2;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
VAR AFORM:tform2;
begin
AFORM:=tform2.CREATE(APPLICATION);
aform.show;
end;
end.
------Unit2.pas---------
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm2 = class(TForm)
private
procedure CreateParams(VAR Params: TCreateParams);
override;
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.DFM}
procedure TForm2.CreateParams(VAR Params: TCreateParams);
begin
Inherited CreateParams(Params);
Params.WndParent := GetDesktopWindow;
end;
end.