实现界面(50分)

  • 主题发起人 主题发起人 landina
  • 开始时间 开始时间
L

landina

Unregistered / Unconfirmed
GUEST, unregistred user!
如何实现当主窗口Show一个窗口时,在Windows的任务栏中显示此窗口,这样可以在主窗口和本窗口的切换。
 
搜索论坛,讨论过了!
 
protected
procedure CreateParams(var Params: TCreateParams); override;
....
procedure TfmMatchRec.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.wndParent := GetDesktopWindow;
end;
 
学习学习。
 
学习GipsyCN的方法,正确.
主窗体form1调用form2,form2在任务栏显示程序图标:
在form2中添加
protected
procedure CreateParams(var Params: TCreateParams); override;

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.wndParent := GetDesktopWindow;
end;
 
SetWindowLong(Handle, GWL_EXSTYLE,WS_EX_APPWINDOW);
 
to:yt_wyb
SetWindowLong(Handle, GWL_EXSTYLE,WS_EX_APPWINDOW);
可以实现要求,但有个问题不知阁下是否遇见过,当我Show Form2后,我想在Windows任务栏中切换
可怎么也不行,只能最小化Form2或单击Form1窗口才能切换过来。
 
下面这个也可以。
procedure CreateParams(var Params:TCreateParams);override;

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle:=WS_EX_APPWINDOW;
end;
 
minimize non-main forms to the taskbar

From: David Watt <bm01393@themis.ag.gov.bc.ca>

I posted a message a few weeks ago asking about how to minimize non-main forms
to the taskbar, or more precisely, how to minimize applications to the taskbar
from forms other than the main form. (I find the fact that secondary forms
minimize to the desktop really unappealing.) I received a number of replies
(and thanks for those) but no one had an answer. After a little surfing and
some trial-and-error I've come up with a solution.

In order to have secondary forms minimize the application to the taskbar all
you need are the following two steps.

1. Declare a private message handling procedure within the secondary form which
will intercept messages destine for the form.


--------------------------------------------------------------------------------

private
{ Private declarations }
procedure WMSysCommand(var Message: TMessage); message WM_SYSCOMMAND;


--------------------------------------------------------------------------------

2. Create a procedure in the secondary form's implementation section which
intercepts messages and puts in place a substitution for SC_MINIMIXE messages
so that the Application.Minimize procedure is executed instead. All other
messages pass through normally; they are inherited.


--------------------------------------------------------------------------------

procedure TForm2.WMSysCommand(var Message: TMessage);
begin
if (Message.WParam = SC_MINIMIZE) then
Application.Minimize
else
inherited;
end;


--------------------------------------------------------------------------------

That's does the trick.

特别适合MDI
 
多人接受答案了。
 
后退
顶部