procedure TForm1.GetHandles; begin //得到Tray Bar的窗口句柄; Wnd[0]:=FindWindow(′ShellTrayWnd′,nil); //得到开始按钮的窗口句柄; Wnd[1]:=FindWindow(′ShellTrayWnd′,nil); Wnd[1]:=FindWindowEx(Wnd[1],HWND(0),′Button′,nil); //得到应用程序切换区的窗口句柄; Wnd[2]:=FindWindow(′ShellTrayWnd′,nil); Wnd[2]]:=FindWindowEx(Wnd[2],HWND(0),′ReBarWindow32′,nil); //得到任务栏通知区的窗口句柄; Wnd[3]:=FindWindow(′ShellTrayWnd′,nil); Wnd[3]:=FindWindowEx(Wnd[3],HWND(0),′TrayNotifyWnd′,nil); //得到任务栏时钟的窗口句柄; Wnd[4]:=FindWindow(′ShellTrayWnd′,nil); Wnd[4]:=FindWindowEx(Wnd[4],HWND(0),′TrayNotifyWnd′,nil); Wnd[4]:=FindWindowEx(Wnd[4],HWND(0),′TrayCLockWClass′,nil); end; |
procedure TForm1.EnableOrDisable(Sender:TOBject); begin GetHandles; if TCheckBox(Sender). Checked then case TCheckBox(Sender). Tag of 0: EnableWindow(Wnd[0], False); 1: EnableWindow(Wnd[1], False); 2: EnableWindow(Wnd[2], False); 3: EnableWindow(Wnd[3], False); 4: EnableWindow(Wnd[4], False); end else case TCheckBox(Sender). Tag of 0: EnableWindow(Wnd[0], True); 1: EnableWindow(Wnd[1], True); 2: EnableWindow(Wnd[2], True); 3: EnableWindow(Wnd[3], True); 4: EnableWindow(Wnd[4], True); end; end; |
procedure TForm1.HideOrShow(Sender:TObject); begin GetHandles; if TCheckBox(Sender). Checked then case TCheckBox(Sender). Tag of 0: ShowWindow(Wnd[0],SWHIDE); 1: ShowWindow(Wnd[1],SWHIDE); 2: ShowWindow(Wnd[2],SWHIDE); 3: ShowWindow(Wnd[3],SWHIDE); 4: ShowWindow(Wnd[4],SWHIDE); end else case TCheckBox(Sender). Tag of 0: ShowWindow(Wnd[0],SWShow); 1: ShowWindow(Wnd[1],SWShow); 2: ShowWindow(Wnd[2],SWShow); 3: ShowWindow(Wnd[3],SWShow); 4: ShowWindow(Wnd[4],SWShow); end; end; |
procedure TForm1.FormClose(Sender:TObject; var Action: TCloseAction); var i:Integer; begin for i:=0 to 4 do begin EnableWindow(Wnd[i],True); ShowWindow(Wnd[i],SWShow); end; end; |