本文整理自网络,侵删。
procedure ChangeAppWindow(const Handle: THandle; const SetAppWindow, RestoreVisibility: Boolean);var Style: Integer; WasVisible, WasIconic: Boolean;begin Style := GetWindowLong(Handle, GWL_EXSTYLE); if (SetAppWindow and (Style and WS_EX_APPWINDOW = 0)) or (not SetAppWindow and (Style and WS_EX_APPWINDOW = WS_EX_APPWINDOW)) then begin
WasVisible := IsWindowVisible(Handle); if WasVisible or WasIconic then begin ShowWindow(Handle, SW_HIDE); end else begin ShowWindow(Handle, SW_SHOW); end; end;end;
procedure TForm1.Button1Click(Sender: TObject);begin ChangeAppWindow(form1.Handle, False, False);
end;
procedure TForm1.Button2Click(Sender: TObject);begin ChangeAppWindow(form1.Handle, True, True);end;
相关阅读 >>
Delphi 中将tmemorystream转换为'string'
更多相关阅读请进入《Delphi》频道 >>