一个很急的问题,网易那里没人知道,请大家帮忙,谢谢!(100分)

  • 主题发起人 主题发起人 UserKey
  • 开始时间 开始时间
U

UserKey

Unregistered / Unconfirmed
GUEST, unregistred user!
非常棘手的一件事情,不知道那位可以解决: <br><br>本人在制作托盘程序,其他的都一切顺利,可就是到了让程序不在任务栏中显示的时候就不行了,起作用的语句是这句: <br>SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); <br>可如果把这句放在Form的OnCreate事件中执行就没问题,可如果在用户最小化窗体的时候执行该语句就不行了.是不是因为MDI窗体的问题?望大家帮忙解决一下,谢谢了。 <br><br>在此过程中运行成功 <br>procedure TForm1.FormCreate(Sender: TObject); <br>begin <br>&nbsp; &nbsp;SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); <br>end; <br><br>在此过程中失败 <br>procedure TForm1.FormResize(Sender: TObject); <br>begin <br>&nbsp; SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); <br>end; <br><br>
 
procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_STYLE) and (not WS_CAPTION));<br>&nbsp; Height:=ClientHeight;<br>&nbsp; Width:=ClientWidth;<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>&nbsp; SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_STYLE) or (WS_CAPTION));<br>&nbsp; Height:=ClientHeight;<br>&nbsp; Width:=ClientWidth;<br>end;<br>
 
谢谢您的回答,可是您的答案是错的。<br>还有那位朋友会呀?
 
faint ,错了,得改成你需要的style
 
在formresize中窗体最小化的时候不触发。<br>
 
可如何改成我的style呢?<br>我是初学。。:)
 
<br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; procedure AppMini(Sender: TObject);<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; Application.OnMinimize := AppMini; &nbsp;//指定最小化时触发的事件<br>end;<br><br>procedure TForm1.AppMini(Sender: TObject);<br>Begin<br>&nbsp; showmessage('最小化了...');<br>End;<br><br>end.<br><br>
 
procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_EXSTYLE) and (not WS_CAPTION));<br>&nbsp; Height:=ClientHeight;<br>&nbsp; Width:=ClientWidth;<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>&nbsp; SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_EXSTYLE) or (WS_CAPTION));<br>&nbsp; Height:=ClientHeight;<br>&nbsp; Width:=ClientWidth;<br>end;<br><br>
 
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); <br>这条语句的某些属性的设置,只能在窗口创建时进行。所以放在其它地方会。。。。<br><br>要想最小化时不在任务栏显示,可以<br>&nbsp; showwindow(handle,SW_HIDE);<br>点击托盘显示主窗口时再用<br>&nbsp; showwindow(handle,SW_SHOW); &nbsp;//or &nbsp;SW_SHOWNORMAL<br><br>可能直接用 hide,show 方法也可以,道理应该一样。<br>
 
后退
顶部