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
|
function donne_Trayform: integer;
var
hdle: integer;
begin
hdle := FindWindow('Shell_TrayWnd', nil);
Hdle := FindWindowEx(hdle, 0, 'TrayNotifyWnd', nil);
result := FindWindowEx(hdle, 0, 'TTrayForm', nil);
end;
function donne_Hdle_Clock: integer;
var
hdle: integer;
begin
hdle := FindWindow('Shell_TrayWnd', nil);
Hdle := FindWindowEx(hdle, 0, 'TrayNotifyWnd', nil);
result := FindWindowEx(hdle, 0, 'TrayClockWClass', nil);
end;
function TrayIconWindowHandle: HWnd;
var
trayHWnd: HWnd;
begin
trayHWnd := FindWindow('Shell_TrayWnd', nil);
result := FindWindowEx(trayHWnd, 0, 'TrayNotifyWnd', nil);
end;
procedure Tform1.creation_control;
var
Tray_taille, taille2: Trect;
larg, haut: integer;
begin
GetWindowRect(donne_Hdle_Clock, Tray_taille);
GetWindowRect(TrayIconWindowHandle, taille2);
if donne_Trayform = 0 then
try
Trayform := TTrayform.CreateParented(TrayIconWindowHandle);
Trayform.ParentWindow := TrayIconWindowHandle;
Trayform.show;
except; end;
larg := Tray_taille.right - Tray_taille.left;
haut := Tray_taille.bottom - Tray_taille.top - 13;
MoveWindow(Trayform.handle, Tray_taille.left - taille2.left + 0,
Tray_taille.top - taille2.top + 8, larg,
haut, true);
end; |
Partager