delphi的最小化问题? 当然可以,看看以前的帖子用win api 实现的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1、虽然在Delphi中把窗口的属性BorderStyle设为bsNone可以让标题栏消失,但同时窗口却不能缩放了,下面这段代码可以使你鱼和熊掌兼得:procedure TForm1.FormCreate(Sender: TObject);begin SetWindowLong(Handle,GWL_STYLE, GetWindowLong(Handle,GWL_STYLE) AND NOT WS_CAPTION); ClientHeight := Height;end;2、TNotifyIcon 控件1.01 (Build use Delphi 3.0) 说明:作用: 往通知区加图标,并可显示,隐藏,修改这个图标. 属性(properties): NotifyIcon:TIcon 欲加在通知区的图标 IsVisible:boolean NotifyIcon是否显示的属性 Title:string 通知区图标上的提示(最多64个字符) PopupMenu:TPopupMenu 点击通知区图标弹出的菜单 PopupStyle:TPopupStyle 弹出菜单的方式 TPopupStyle=Set of (Left_Click,Right_Click,Left_DbClick,Right_DbClick);方法(methods): ShowIcon 将图标显示在通知区上 HideIcon 将通知区上的图标隐藏 ModifyIcon 修改通知区上的图标(若IsVisible=false,则不显示出来) Create(AOwner: TComponent); override; 构造方法 Destroy; override; 析构方法事件(Events): OnIconMouseDown: procedure(Sender:TObject;x,y:Word;WhoButton:TWhoButton) of Object; ( 在Mouse点击通知区上的图标时发生,x,y为Mouse在屏幕上的坐标, WhoButton=b_Left为点击左键,WhoButton=b_Right为点击右键, ) OnIconDoubleClick: procedure(Sender:TObject;x,y:Word;WhoButton:TWhoButton) of Object; ( 在Mouse双击通知区上的图标时发生,x,y为Mouse在屏幕上的坐标, WhoButton=b_Left为双击左键,WhoButton=b_Right为双击右键, )关于Demo: 这个演示程序给出了TNotifyIcon的基本用法.包含文件: NotifyIcon.dcr NotifyIcon.pas DemoUnit.pas DemoUnit.dfm PopUnit.pas PopUnit.dfm Demo.dpr Readme.txt声明: TNotifyIcon 控件 V 1.011.这是一个免费控件.2.如果你使用它,请发一个E-Mail给作者,谢谢.3我在Delphi3.0 & 4.0 上使用成功4.若要传播它,请完全分发上述8个文件 作者 南昌大学计算系95(1) 付昱纲 1998.8.17 21:50 E-mail [email protected] unit NotifyIcon;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DsgnIntf,ShellApi,ExtCtrls,Menus;const WM_MY_Notify=WM_USER+100;type TPopupStyle=Set of (Left_Click,Right_Click,Left_DbClick,Right_DbClick); TWhoButton=(b_Left,b_Right); TMouseEvent= procedure(Sender:TObject;x,y:Word;WhoButton:TWhoButton) of Object;//---------class TNotifyIcon--------- TNotifyIcon = class(TCustomControl) private { Private declarations } FIcon:TIcon; FPda:PNOTIFYICONDATA; FTitle:string; FIconVisible:boolean; FPopupMenu:TPopupMenu; FPopupStyle:TPopupStyle; FOnIconMouseDown:TMouseEvent; FOnIconDoubleClick:TMouseEvent; procedure SetIcon(Icon:TICON); procedure SetTitle(NewTitle:string); function IsShowing:boolean; procedure ShowIt(Accept:boolean); procedure NotifyIconClick(var msg : TMessage); Message WM_My_Notify; protected { Protected declarations } public { Public declarations } property IsVisible:boolean read IsShowing write ShowIt; constructor Create(AOwner: TComponent); override; procedure ShowIcon; procedure HideIcon; destructor Destroy; override; procedure ModifyIcon(NewIcon:TIcon); procedure Paint;override; published { Published declarations } property Height default 33; property Width default 33; property NotifyIcon:TIcon read FIcon write SetIcon; property Title:string read FTitle write SetTitle ; property OnIconDoubleClick:TMouseEvent read FOnIconDoubleClick write FOnIconDoubleClick; property OnIconMouseDown:TMouseEvent read FOnIconMouseDown write FOnIconMouseDown; property PopupMenu:TPopupMenu read FPopupMenu write FPopupMenu; property PopupStyle:TPopupStyle read FPopupStyle write FPopupStyle default []; end;procedure Register;implementationprocedure Register;begin RegisterComponents('MyControl', [TNotifyIcon]);end;procedure TNotifyIcon.ShowIt(Accept:boolean);begin if Accept=true then ShowIcon else HideIcon;end;procedure TNotifyIcon.Paint;beginif (csDesigning in ComponentState) thenbegin Width:=33; Height:=33; With Canvas do begin Brush.Color:=clInfoBk; Ellipse(0,0,Self.Width,Self.Height); Font.Color:=clBlue; Brush.Style:=bsClear; FloodFill(5,5,clInfoBk,fsBorder); Brush.Color:=clInfoBk; TextOut(3,Self.Height div 2-6,'Notify'); endend;end;procedure TNotifyIcon.NotifyIconClick(var msg : TMessage); var p:TPoint;begin try case msg.LParam of WM_LBUTTONDOWN: begin GetCursorPos(p); if Left_Click in FPopupStyle then begin SetForegroundWindow(ParentWindow); FPopupMenu.Popup(p.x,p.y); end; if Assigned(FOnIconMouseDown) then begin FOnIconMouseDown(Self,p.x,p.y,b_Left); end; end; WM_RBUTTONDOWN: begin GetCursorPos(p); if Right_Click in FPopupStyle then begin SetForegroundWindow(ParentWindow); FPopupMenu.Popup(p.x,p.y); end; if Assigned(FOnIconMouseDown) then begin FOnIconMouseDown(Self,p.x,p.y,b_Right); end; end; WM_LBUTTONDBLCLK: begin GetCursorPos(p); if Left_DbClick in FPopupStyle then begin SetForegroundWindow(ParentWindow); FPopupMenu.Popup(p.x,p.y); end; if Assigned(FOnIconDoubleClick) then begin FOnIconDoubleClick(Self,p.x,p.y,b_Left); end; end; WM_RBUTTONDBLCLk: begin GetCursorPos(p); if Right_Click in FPopupStyle then begin SetForegroundWindow(ParentWindow); FPopupMenu.Popup(p.x,p.y); end; if Assigned(FOnIconDoubleClick) then begin FOnIconDoubleClick(Self,p.x,p.y,b_Right); end; end; end; except end;end;function MAKELANGID(p, s:word):Cardinal;begin result:= (((s)shl 10) or(p));end;constructor TNotifyIcon.Create(AOwner: TComponent);begintry inherited Create(AOwner); FIcon:=TIcon.Create; Height:=36; Width:=36; Visible:=false; FTitle:='Welcome'; FIconVisible:=false; //-------------set tray info--------- ParentWindow:=TWinControl(AOwner).Handle; New(Fpda); With FPda^ do begin uCallbackMessage:=WM_MY_Notify; cbsize:=SizeOf(FPda^); uID:=200; wnd:=Handle; uFlags:=NIF_ICON+NIF_Tip+NIF_MESSAGE; end;if (csDesigning in ComponentState) thenbegin if GetUserDefaultLCID = MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED) then Application.MessageBox( 'Write by 南昌大学 付昱纲'#13#13'E-mail:[email protected]'#13#13' 1998.8.17', 'TNotifyIcon 控件 V 1.01',MB_OK+ MB_ICONINFORMATION) else Application.MessageBox( 'Write by NanChang University FuYuGang'#13#13'E-mail:[email protected]'#13#13' 1998.8.17', 'TNotifyIcon Component V 1.01',MB_OK+ MB_ICONINFORMATION);end; except ShowMessage('TNotifyIcon Create error'); end;end;procedure TNotifyIcon.SetIcon(Icon:TICON);begin FIcon.Assign(Icon);end;procedure TNotifyIcon.ShowIcon;begintry if FIcon.Handle=0 then begin Exit; end; if FIcon.Handle<>FPda^.hIcon then HideIcon; if FIconVisible=false then begin FPda^.hIcon:=FIcon.handle; FIconVisible:=true; Shell_NotifyIcon(NiM_ADD,FPda); end;except ShowMessage('TNotifyIcon Show Error ');end;end;procedure TNotifyIcon.HideIcon;begintry if FIconVisible then begin FIconVisible:=false; Shell_NotifyIcon(NiM_DELETE,FPda); end;except ShowMessage('TNotifyIcon Hide Error');end;end;procedure TNotifyIcon.SetTitle(NewTitle:string);begin FTitle:=NewTitle; StrCopy(FPda^.szTip,PChar(FTitle)); if FIconVisible then begin HideIcon; ShowIcon; end;end;destructor TNotifyIcon.Destroy;begintry HideIcon; Dispose(FPda); FIcon.Free; inherited Destroy;except ShowMessage('TNotifyIcon Destroy Error');end;end;procedure TNotifyIcon.ModifyIcon(NewIcon:TIcon);begintry SetIcon(NewIcon); FPda^.hIcon:=FIcon.handle; if FIconVisible then Shell_NotifyIcon(NiM_Modify,FPda);except ShowMessage('TNotifyIcon Modify Error');end;end;function TNotifyIcon.IsShowing:boolean;begin Result:=FIconVisible;end;end.--回复得分 0 --Firing_sky 说得很详细了,但是要做通知栏的图标也很简单,应用几个函数(自己写),InstallIcon,UnInstallIcon,IconClick.下面是他们的简单实例:安装图表:procedure TForm1.InstallIcon;var CDIcon:TNotifyICondata;begin normalIcon:=TIcon.Create; normalIcon:=form1.Icon; CDIcon.cbSize:=sizeof(CDIcon); CDIcon.Wnd:=handle; CDIcon.uID:=ICON_ID; CDIcon.uFlags:= NIF_ICON or NIF_MESSAGE or NIF_TIP; CDIcon.uCallbackMessage:=MI_ICONEVENT; CDIcon.hIcon:=normalicon.Handle; CDIcon.szTip:='光驱控制'; Shell_NotifyIcon(NIM_ADD,@CDIcon);end;卸载图标:procedure TForm1.UnInstallIcon;var CDIcon:TNotifyIconData;begin CDIcon.cbSize:=sizeof(CDIcon); CDIcon.Wnd:=Handle; CDIcon.uID:=ICON_ID; Shell_NotifyIcon(NIM_DELETE,@CDIcon);// normalIcon.Free;end;响应click事件:procedure TForm1.IconOnClick(var message:TMessage);var p:TPoint;begin if (message.LParam=WM_LBUTTONDBLCLK) then ShowWindow(handle,SW_SHOW); if (message.LParam=WM_RBUTTONDOWN) then begin GetCursorPos(p); pop1.Popup(p.x,p.y); end;end; 这么一大篇,没有看清问题。:)你把那个窗体的属主设成DesktopWindow(桌面)就可以了。不是TComponent.Owner。用API函数SetParent:Windows.SetParent(Form.Handle, 0); 两句话:procedure Tform1.button1click(sender:tobject);beginh:=handle;//全局变量,记住当前显示窗体的句柄closewindow(application.handle);end;要复原时:在applicationevents.onrestore的事件中写入如下代码:procedure Tform1.ApplicationEvents1Restore(Sender: TObject);beginshowwindow(application.handle,1);setactivewindow(mfh);end;showwindow(application.handle,1);setactivewindow(h); sorry, cpu同志,我的API函数用错了,应当用SetWindowLong(Form.Handle, GWL_HWNDPARENT, 0),这个才设置其属主窗体。另外,你可在该Form中重载CreateParams方法,也能达到目的,如:unit Unit2;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type TForm2 = class(TForm) private { Private declarations } protected 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 := 0;end;end. Raptor(猛禽) (2001-6-14 22:23:00) 得0分 “除非这个窗体不是主窗体 ”right!!!!!!!!!!!!!!!!!!! 登陆窗口中AdoQuery查询的问题 DBTree根据一个字段创建树的菜单 关于搜索引擎 ado无法连接远端SQL服务器 IdFtp多线程下载同一个文件问题 以下這問題您解決了,我拜你了“師”。 TStream 怎么一个字节一个字节的读呢? 哪有FOR DELPHI5,6的财务票据方面的控件下载? 愚蠢的送分问题:) 哈哈,花血本买了一本<<Delphi COM深入编程>>,咱这个双休日非把COM技术从现在的不懂到熟练不可,大家说点鼓励的吧 一个本人不会的简单问题 关于Delphi编译的奇怪问题-TDateTimePicker,求解释。
让标题栏消失,但同时窗口却不能缩放了,下面这段代码可以使你
鱼和熊掌兼得:
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowLong(Handle,GWL_STYLE, GetWindowLong(Handle,GWL_STYLE)
AND NOT WS_CAPTION);
ClientHeight := Height;
end;
2、TNotifyIcon 控件1.01 (Build use Delphi 3.0) 说明:
作用:
往通知区加图标,并可显示,隐藏,修改这个图标.
属性(properties):
NotifyIcon:TIcon 欲加在通知区的图标
IsVisible:boolean NotifyIcon是否显示的属性
Title:string 通知区图标上的提示(最多64个字符)
PopupMenu:TPopupMenu 点击通知区图标弹出的菜单
PopupStyle:TPopupStyle 弹出菜单的方式
TPopupStyle=Set of (Left_Click,Right_Click,Left_DbClick,Right_DbClick);
方法(methods):
ShowIcon 将图标显示在通知区上
HideIcon 将通知区上的图标隐藏
ModifyIcon 修改通知区上的图标(若IsVisible=false,则不显示出来)
Create(AOwner: TComponent); override; 构造方法
Destroy; override; 析构方法
事件(Events):
OnIconMouseDown:
procedure(Sender:TObject;x,y:Word;WhoButton:TWhoButton) of Object;
(
在Mouse点击通知区上的图标时发生,x,y为Mouse在屏幕上的坐标,
WhoButton=b_Left为点击左键,WhoButton=b_Right为点击右键,
)
OnIconDoubleClick:
procedure(Sender:TObject;x,y:Word;WhoButton:TWhoButton) of Object;
(
在Mouse双击通知区上的图标时发生,x,y为Mouse在屏幕上的坐标,
WhoButton=b_Left为双击左键,WhoButton=b_Right为双击右键,
)
关于Demo:
这个演示程序给出了TNotifyIcon的基本用法.包含文件:
NotifyIcon.dcr
NotifyIcon.pas
DemoUnit.pas
DemoUnit.dfm
PopUnit.pas
PopUnit.dfm
Demo.dpr
Readme.txt声明:
TNotifyIcon 控件 V 1.01
1.这是一个免费控件.
2.如果你使用它,请发一个E-Mail给作者,谢谢.
3我在Delphi3.0 & 4.0 上使用成功
4.若要传播它,请完全分发上述8个文件 作者 南昌大学计算系95(1) 付昱纲 1998.8.17 21:50
E-mail [email protected] unit NotifyIcon;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DsgnIntf,ShellApi,ExtCtrls,Menus;const
WM_MY_Notify=WM_USER+100;
type TPopupStyle=Set of (Left_Click,Right_Click,Left_DbClick,Right_DbClick);
TWhoButton=(b_Left,b_Right);
TMouseEvent=
procedure(Sender:TObject;x,y:Word;WhoButton:TWhoButton)
of Object;//---------class TNotifyIcon---------
TNotifyIcon = class(TCustomControl)
private
{ Private declarations }
FIcon:TIcon;
FPda:PNOTIFYICONDATA;
FTitle:string;
FIconVisible:boolean;
FPopupMenu:TPopupMenu;
FPopupStyle:TPopupStyle;
FOnIconMouseDown:TMouseEvent;
FOnIconDoubleClick:TMouseEvent;
procedure SetIcon(Icon:TICON);
procedure SetTitle(NewTitle:string);
function IsShowing:boolean;
procedure ShowIt(Accept:boolean);
procedure NotifyIconClick(var msg : TMessage);
Message WM_My_Notify;
protected
{ Protected declarations }
public
{ Public declarations }
property IsVisible:boolean read IsShowing write ShowIt;
constructor Create(AOwner: TComponent); override;
procedure ShowIcon;
procedure HideIcon;
destructor Destroy; override;
procedure ModifyIcon(NewIcon:TIcon);
procedure Paint;override;
published
{ Published declarations }
property Height default 33;
property Width default 33;
property NotifyIcon:TIcon read FIcon write SetIcon;
property Title:string read FTitle write SetTitle ;
property OnIconDoubleClick:TMouseEvent
read FOnIconDoubleClick write FOnIconDoubleClick;
property OnIconMouseDown:TMouseEvent
read FOnIconMouseDown write FOnIconMouseDown;
property PopupMenu:TPopupMenu read FPopupMenu write FPopupMenu;
property PopupStyle:TPopupStyle read FPopupStyle
write FPopupStyle default [];
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('MyControl', [TNotifyIcon]);
end;procedure TNotifyIcon.ShowIt(Accept:boolean);
begin
if Accept=true then ShowIcon
else HideIcon;
end;procedure TNotifyIcon.Paint;
begin
if (csDesigning in ComponentState) then
begin
Width:=33;
Height:=33;
With Canvas do
begin
Brush.Color:=clInfoBk;
Ellipse(0,0,Self.Width,Self.Height);
Font.Color:=clBlue;
Brush.Style:=bsClear;
FloodFill(5,5,clInfoBk,fsBorder);
Brush.Color:=clInfoBk;
TextOut(3,Self.Height div 2-6,'Notify');
end
end;
end;procedure TNotifyIcon.NotifyIconClick(var msg : TMessage);
var p:TPoint;
begin
try
case msg.LParam of
WM_LBUTTONDOWN:
begin
GetCursorPos(p);
if Left_Click in FPopupStyle then
begin
SetForegroundWindow(ParentWindow);
FPopupMenu.Popup(p.x,p.y);
end;
if Assigned(FOnIconMouseDown) then
begin
FOnIconMouseDown(Self,p.x,p.y,b_Left);
end;
end;
WM_RBUTTONDOWN:
begin
GetCursorPos(p);
if Right_Click in FPopupStyle then
begin
SetForegroundWindow(ParentWindow);
FPopupMenu.Popup(p.x,p.y);
end;
if Assigned(FOnIconMouseDown) then
begin
FOnIconMouseDown(Self,p.x,p.y,b_Right);
end;
end;
WM_LBUTTONDBLCLK:
begin
GetCursorPos(p);
if Left_DbClick in FPopupStyle then
begin
SetForegroundWindow(ParentWindow);
FPopupMenu.Popup(p.x,p.y);
end;
if Assigned(FOnIconDoubleClick) then
begin
FOnIconDoubleClick(Self,p.x,p.y,b_Left);
end;
end;
WM_RBUTTONDBLCLk:
begin
GetCursorPos(p);
if Right_Click in FPopupStyle then
begin
SetForegroundWindow(ParentWindow);
FPopupMenu.Popup(p.x,p.y);
end;
if Assigned(FOnIconDoubleClick) then
begin
FOnIconDoubleClick(Self,p.x,p.y,b_Right);
end;
end;
end;
except
end;
end;function MAKELANGID(p, s:word):Cardinal;
begin
result:= (((s)shl 10) or(p));
end;constructor TNotifyIcon.Create(AOwner: TComponent);
begin
try
inherited Create(AOwner);
FIcon:=TIcon.Create;
Height:=36;
Width:=36;
Visible:=false;
FTitle:='Welcome';
FIconVisible:=false;
//-------------set tray info---------
ParentWindow:=TWinControl(AOwner).Handle;
New(Fpda);
With FPda^ do
begin
uCallbackMessage:=WM_MY_Notify;
cbsize:=SizeOf(FPda^);
uID:=200;
wnd:=Handle;
uFlags:=NIF_ICON+NIF_Tip+NIF_MESSAGE;
end;if (csDesigning in ComponentState) then
begin
if GetUserDefaultLCID = MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED) then
Application.MessageBox(
'Write by 南昌大学 付昱纲'#13#13'E-mail:[email protected]'#13#13' 1998.8.17',
'TNotifyIcon 控件 V 1.01',MB_OK+ MB_ICONINFORMATION)
else
Application.MessageBox(
'Write by NanChang University FuYuGang'#13#13'E-mail:[email protected]'#13#13' 1998.8.17',
'TNotifyIcon Component V 1.01',MB_OK+ MB_ICONINFORMATION);
end;
except
ShowMessage('TNotifyIcon Create error');
end;
end;procedure TNotifyIcon.SetIcon(Icon:TICON);
begin
FIcon.Assign(Icon);
end;procedure TNotifyIcon.ShowIcon;
begin
try
if FIcon.Handle=0 then
begin
Exit;
end;
if FIcon.Handle<>FPda^.hIcon then
HideIcon;
if FIconVisible=false then
begin
FPda^.hIcon:=FIcon.handle;
FIconVisible:=true;
Shell_NotifyIcon(NiM_ADD,FPda);
end;
except
ShowMessage('TNotifyIcon Show Error ');
end;
end;procedure TNotifyIcon.HideIcon;
begin
try
if FIconVisible then
begin
FIconVisible:=false;
Shell_NotifyIcon(NiM_DELETE,FPda);
end;
except
ShowMessage('TNotifyIcon Hide Error');
end;
end;procedure TNotifyIcon.SetTitle(NewTitle:string);
begin
FTitle:=NewTitle;
StrCopy(FPda^.szTip,PChar(FTitle));
if FIconVisible then
begin
HideIcon;
ShowIcon;
end;
end;destructor TNotifyIcon.Destroy;
begin
try
HideIcon;
Dispose(FPda);
FIcon.Free;
inherited Destroy;
except
ShowMessage('TNotifyIcon Destroy Error');
end;
end;procedure TNotifyIcon.ModifyIcon(NewIcon:TIcon);
begin
try
SetIcon(NewIcon);
FPda^.hIcon:=FIcon.handle;
if FIconVisible then
Shell_NotifyIcon(NiM_Modify,FPda);
except
ShowMessage('TNotifyIcon Modify Error');
end;
end;function TNotifyIcon.IsShowing:boolean;
begin
Result:=FIconVisible;
end;end.
--回复得分 0 --
Firing_sky 说得很详细了,但是要做通知栏的图标也很简单,应用几个函数(自己写),
InstallIcon,UnInstallIcon,IconClick.
下面是他们的简单实例:
安装图表:
procedure TForm1.InstallIcon;
var
CDIcon:TNotifyICondata;
begin
normalIcon:=TIcon.Create;
normalIcon:=form1.Icon;
CDIcon.cbSize:=sizeof(CDIcon);
CDIcon.Wnd:=handle;
CDIcon.uID:=ICON_ID;
CDIcon.uFlags:= NIF_ICON or NIF_MESSAGE or NIF_TIP;
CDIcon.uCallbackMessage:=MI_ICONEVENT;
CDIcon.hIcon:=normalicon.Handle;
CDIcon.szTip:='光驱控制';
Shell_NotifyIcon(NIM_ADD,@CDIcon);
end;卸载图标:
procedure TForm1.UnInstallIcon;
var
CDIcon:TNotifyIconData;
begin
CDIcon.cbSize:=sizeof(CDIcon);
CDIcon.Wnd:=Handle;
CDIcon.uID:=ICON_ID;
Shell_NotifyIcon(NIM_DELETE,@CDIcon);
// normalIcon.Free;
end;响应click事件:
procedure TForm1.IconOnClick(var message:TMessage);
var
p:TPoint;
begin
if (message.LParam=WM_LBUTTONDBLCLK) then
ShowWindow(handle,SW_SHOW);
if (message.LParam=WM_RBUTTONDOWN) then
begin
GetCursorPos(p);
pop1.Popup(p.x,p.y);
end;
end;
用API函数SetParent:Windows.SetParent(Form.Handle, 0);
procedure Tform1.button1click(sender:tobject);
begin
h:=handle;//全局变量,记住当前显示窗体的句柄
closewindow(application.handle);
end;要复原时:
在applicationevents.onrestore的事件中写入如下代码:
procedure Tform1.ApplicationEvents1Restore(Sender: TObject);
begin
showwindow(application.handle,1);
setactivewindow(mfh);
end;
showwindow(application.handle,1);
setactivewindow(h);
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TForm2 = class(TForm)
private
{ Private declarations }
protected
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 := 0;
end;end.
“除非这个窗体不是主窗体 ”right!!!!!!!!!!!!!!!!!!!