AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Tray-Icon entfernen nach Beenden des Prozesses
Thema durchsuchen
Ansicht
Themen-Optionen

Tray-Icon entfernen nach Beenden des Prozesses

Ein Thema von ernschd · begonnen am 3. Dez 2009 · letzter Beitrag vom 7. Dez 2009
Antwort Antwort
Madtrax

Registriert seit: 15. Sep 2003
19 Beiträge
 
#1

Re: Tray-Icon entfernen nach Beenden des Prozesses

  Alt 4. Dez 2009, 13:30
Hallo

Ich habe das gleiche Problem die Tage auch gehabt und eine sehr einfache und schöne Lösung gefunden.
Das Icon verschwindet wenn man mit der Maus darüber fährt, richtig ?
Also machen wir uns das zunutze und machen das mit Sourcecode. Gesagt sei dabei, dass die Maus nicht wirklich verschoben wird.
Habe den Code im Internet gefunden. Weiß allerdings auch nicht mehr wo genau. Schau es dir mal an....

Delphi-Quellcode:
Procedure KillTrayIcon;
var
    wnd : cardinal;
    rec : TRect;
    w,h : integer;
    x,y : integer;
begin
    // find a handle of a tray
    wnd := FindWindow('Shell_TrayWnd', nil);
    wnd := FindWindowEx(wnd, 0, 'TrayNotifyWnd', nil);
    wnd := FindWindowEx(wnd, 0, 'SysPager', nil);
    wnd := FindWindowEx(wnd, 0, 'ToolbarWindow32', nil);
    // get client rectangle (needed for width and height of tray)
    windows.GetClientRect(wnd, rec);
    // get size of small icons
    w := GetSystemMetrics(sm_cxsmicon);
    h := GetSystemMetrics(sm_cysmicon);
    // initial y position of mouse - half of height of icon
    y := w shr 1;
    while y < rec.Bottom do begin // while y < height of tray
        x := h shr 1; // initial x position of mouse - half of width of icon
        while x < rec.Right do begin // while x < width of tray
            SendMessage(wnd, wm_mousemove, 0, y shl 16 or x); // simulate moving mouse over an icon
            x := x + w; // add width of icon to x position
        end;
        y := y + h; // add height of icon to y position
    end;
end;
-----------------------------------
Madtrax
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:59 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz