程序运行是我是全屏运行(800X600),并且隐藏任务栏,我的程序有一个缩小按钮,要求点缩小按钮后显示任务栏且程序显示在任务中,并可恢复程序(100分)

  • 主题发起人 主题发起人 topza
  • 开始时间 开始时间
T

topza

Unregistered / Unconfirmed
GUEST, unregistred user!
程序运行是我是全屏运行(800X600),并且隐藏任务栏,我的程序有一个缩小按钮,<br>要求点缩小按钮后显示任务栏且程序显示在任务中,并可恢复程序<br>程序如下:<br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; wndHandle : THandle;<br>&nbsp; wndClass : array[0..50] of Char;<br>&nbsp; &nbsp; &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>StrPCopy(@wndClass[0], 'Shell_TrayWnd');<br>wndHandle := FindWindow(@wndClass[0], nil);<br>ShowWindow(wndHandle, SW_HIDE);<br>form1.SetBounds (0,0,800,600);<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; ShowWindow(wndHandle, SW_show);<br>&nbsp; Sendmessage(handle,wm_syscommand,sc_minimize,0);<br>end;<br><br>end.<br>但有问题,请高手解决!
 
给你这个,你看看吧,这是我前一段时间做的<br><br><br>向系统盒中添加图标的代码:<br><br>procedure TFormMain.AddIcon;<br>var<br>&nbsp; Icon: TNotifyIconData;<br>begin &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; with Icon do<br>&nbsp; begin<br>&nbsp; &nbsp; cbSize := SIZEOF(TNotifyIconData);<br>&nbsp; &nbsp; Wnd := Handle;<br>&nbsp; &nbsp; uID := 1;<br>&nbsp; &nbsp; uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;<br>&nbsp; &nbsp; uCallbackMessage := WM_TRAYICONCALLBACK;<br>&nbsp; &nbsp; hIcon := Application.Icon.Handle;<br>&nbsp; &nbsp; szTip := '电子记事本';<br>&nbsp; end;<br>&nbsp; Shell_NotifyIcon(NIM_ADD,@Icon);<br>end;<br><br>&nbsp; **注意:要在USES子句中加入ShellAPI单元。**<br><br><br>&nbsp; 从系统盒中删除图标的代码:<br>&nbsp; Shell_NotifyIcon(NIM_DELETE,@Icon);<br><br>&nbsp; 在系统盒中响应鼠标事件弹出菜单的代码:<br>procedure TFormMain.WMTRAYICONCALLBACK(var Msg:TMessage);<br>var<br>&nbsp; cursorpos: TPoint;<br>begin<br>&nbsp; case Msg.LParam of<br>&nbsp; WM_LBUTTONDBLCLK: FormMain.Show;<br>&nbsp; WM_RBUTTONDOWN:begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GetCursorPos(cursorpos);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PopupMenu1.Popup(cursorpos.x,cursorpos.y);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br>&nbsp; end;<br>end;
 
其实我只是想现实状态栏自动隐藏的功能,请指教!
 
隐藏和显示Windows的任务条  <br>&nbsp;<br>&nbsp; &nbsp;如何隐藏和显示Windows的任务条?仅仅调用以下的函数就可以。<br>本程序的思路实际上就是先找到标题条的句柄,<br>然后向它发送相应消息(SW_HIDE/SW_RESTORE)即可<br>procedure hideTaskbar; <br>//隐藏 <br>var wndHandle : THandle;<br>wndClass : array[0..50] of Char;<br>begin<br>StrPCopy(@wndClass[0], 'Shell_TrayWnd');<br>wndHandle := FindWindow(@wndClass[0], nil);<br>ShowWindow(wndHandle, SW_HIDE);<br>End;<br><br>//显示<br>procedure showTaskbar;<br>var wndHandle : THandle;<br>wndClass : array[0..50] of Char;<br>begin<br>StrPCopy(@wndClass[0], 'Shell_TrayWnd');<br>wndHandle := FindWindow(@wndClass[0], nil);<br>ShowWindow(wndHandle, SW_RESTORE);<br>end;<br>end;
 
多人接受答案了。
 
后退
顶部