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: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97:
| unit Sh;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,shellapi, CoolTrayIcon, ImgList, Menus, ComCtrls, StdCtrls, ExtCtrls;
type TForm1 = class(TForm) CoolTrayIcon1: TCoolTrayIcon; PopupMenu1: TPopupMenu; Close1: TMenuItem; Config1: TMenuItem; sow: TLabeledEdit; Hide: TLabeledEdit; procedure FormCreate(Sender: TObject); procedure Close1Click(Sender: TObject); procedure Config1Click(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); 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 hnd: HWND;
begin if (isWindowVisible(h2)) or (h2<>0) then else begin hnd := GetForegroundWindow; ShowWindow(hnd,SW_MINIMIZE); ShowWindow(hnd,SW_HIDE); h2:=hnd;
end; end; function showactive():boolean; var hnd: HWND; begin
if h2<>0 then begin ShowWindow(h2,SW_SHOW); 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', 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;
procedure TForm1.Close1Click(Sender: TObject); begin Form1.Close; end;
procedure TForm1.Config1Click(Sender: TObject); begin CoolTrayIcon1.ShowMainForm;
end; |