L
lovewh119
Unregistered / Unconfirmed
GUEST, unregistred user!
自己写了一个当程序窗口最小化时应用程序不出现在Windows的任务栏上的事件,然后通过<br>托盘图标事件来把窗口恢复时,怎么也恢复不了,那位高手指点一下吧`~<br>unit Unit1;<br>interface<br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, Menus, TrayIcon, StdCtrls;<br>type<br> TForm1 = class(TForm)<br> TrayNotifyIcon1: TTrayNotifyIcon;<br> `~<br> `~ <br> private<br> procedure WMSYSCOMMAND(var Msg: Tmessage); message WM_SYSCOMMAND;<br> `~`````<br>implementation<br><br>{$R *.dfm}<br>procedure Tform1.WMSYSCOMMAND(var Msg: Tmessage); //处理message WM_SYSCOMMAND;<br>begin<br> if msg.WParam=SC_MINIMIZE then //当要最小化窗口时<br> begin<br> self.Hide;<br> SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);<br> // 使应用程序不不不出现在Windows的任务栏上<br> self.Show;<br> TrayNotifyIcon1.IconVisible:=true;<br> end;<br> inherited;<br>end;<br>`~~```````<br>procedure TForm1.showClick(Sender: TObject);<br>begin<br> form1.Show;<br> sendmessage(application.Handle,SC_RESTORE,0,0);<br> //TrayNotifyIcon1.IconVisible:=false;<br> end;<br>end.<br>反正我怎么sendmessage都无法恢复窗口,哪位高手指点一下吧`~<br>