DELPHI全屏问题
1 unit Unit1;
2
3 interface
4
5 uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls;
8
9 type
10 TForm1 = class(TForm)
11 Button1: TButton;
12 Button2: TButton;
13 procedure Button1Click(Sender: TObject);
14 procedure Button2Click(Sender: TObject);
15 private
16 { Private declarations }
17 public
18 { Public declarations }
19 end;
20
21 var
22 Form1: TForm1;
23 Hwnd:THandle;
24 Tmp:integer;
25
26
27 implementation
28
29 {$R *.dfm}
30
31 procedure TForm1.Button1Click(Sender: TObject);
32 begin
33 Hwnd:=FindWindow('Shell_TrayWnd',nil);
34 if Hwnd<>0 then ShowWindow(Hwnd,SW_HIDE); //隐藏任务栏
35 SystemParametersInfo(SPI_SCREENSAVERRUNNING,1,@Tmp,0); //屏蔽系统热键
36 Height := screen.height;
37 Width := screen.width;
38 Position :=poScreenCenter;
39 end;
40
41 procedure TForm1.Button2Click(Sender: TObject);
42 begin
43 Hwnd:=FindWindow('Shell_TrayWnd',nil);
44 ShowWindow(Hwnd,SW_SHOW); //恢复任务栏
45 SystemParametersInfo(SPI_SCREENSAVERRUNNING,0,@Tmp,0);//恢复系统热键
46 Height := screen.height-50;
47 Width := screen.width;
48 Position :=poScreenCenter;
49 end;
50
51
52
53 end.