1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78:
| unit Sh;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,shellapi;
type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); protected procedure hotkey(var msg:Tmessage); message WM_HOTKEY; private id:integer; public end;
var Form1: TForm1; h2:hwnd; o,x:integer; implementation uses gamma;
{$R *.dfm} function hideactive():boolean; var rampe: TGammaRamp; hnd: HWND;
begin if (isWindowVisible(h2)) or (h2<>0) then else begin hnd := GetForegroundWindow;
ShowWindow(hnd,SW_HIDE); h2:=hnd;
end; end; function showactive():boolean; var hnd: HWND; rampe: TGammaRamp; begin
if h2<>0 then begin ShowWindow(h2,SW_SHOW); rampe := Tgammaramp.Create; rampe.SetBrightness(0,128); rampe.FreeLib; h2:=0; end; end;
procedure TForm1.hotkey(var msg:TMessage); begin case msg.wparam of 1 : hideactive(); 2 : showactive(); 3 : Form1.Close; end; end; procedure TForm1.FormCreate(Sender: TObject); begin MessageDlg(Format('Screen Width = %d' + #13#10 + 'Screen Height = %d', [Screen.Width, Screen.Height]), mtInformation, [mbOK], 0); RegisterHotkey(handle,1,MOD_CONTROL or MOD_ALT,72); RegisterHotkey(handle,2,MOD_CONTROL or MOD_ALT,83); RegisterHotkey(handle,3,MOD_CONTROL or MOD_ALT,67); end;
end. |