English
Source / code snippets

take off Own Icon Program Systray Tray

 

CompileMarkSeparation
Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
Tray-Icon für das eigene Programm im Systray ablegen
linke Maustaste: Auswahl
rechte Maustaste: Programmfenster zeigen bzw. Programm beenden
#######################
Thema : Tray-Icon
#######################
Andreas Miethe
August 2003
#######################
 $H windows.ph
 $H structs.ph
 $H messages.ph
 $H shellapi.ph
DEF &WM_SHELLNOTIFY  ~WM_USER + 5 shell notify message
DEF &uID 7777
Struct Point = ~Point
Struct Note  = ~NOTIFYICONDATA
Declare Point#,TB_CREATED&
Declare Ende&,Note#,Tip$
SetTrueColor 1
Window %maxx,0 - 640,480Fenster neben den Bildschirm
CLS ~GetSysColor(~COLOR_BTNFACE)
~ShowWindow(%hwnd,~SW_HIDE)Fenster verbergen
~SetWindowPos(%hwnd,0,0,0,640,480,OR(~SWP_NOREDRAW,~SWP_NOACTIVATE))neue Position
Dim Note#,Note
Clear Note#
Note#.cbSize&           = sizeof(Note#)
Note#.hWnd&             = %hwnd
Note#.uID&              = &uID
Note#.hIcon&            = ~LoadIcon(%hInstance,A)
Note#.uFlags&           = Or(Or(~NIF_ICON,~NIF_TIP),~NIF_MESSAGE)
Note#.uCallbackMessage& = &WM_SHELLNOTIFY
Note#.szTip#            =  Tray-Icon Demo
~Shell_NotifyIcon(~NIM_ADD, Note#)
TB_CREATED& = ~RegisterWindowMessage(IconCreated)
UserMessages &WM_SHELLNOTIFY,TB_CREATED&,~WM_CLOSE

Whilenot Ende&

    Waitinput

    If ~IsIconic(%hwnd)Fenster minimiert ??

        ~ShowWindow(%hwnd,~SW_HIDE)

    Endif

    If %UMessage = ~WM_CLOSE

        ~Shell_NotifyIcon(~NIM_DELETE,Note#)
        Ende& = 1

    Endif

    If %UMessage = TB_CREATED&Explorer-Crash. Icon neu anlegen

        ~Shell_NotifyIcon(~NIM_ADD,Note#)

    Endif

    If %UMessage = &WM_SHELLNOTIFY

        If &ULParam = ~WM_RBUTTONDOWNrechter Mausbutton

            ~SetForegroundWindow(%hWnd)
            Dim Point#,Point
            CreateMenu
            AppendMenu 100,Fenster verbergen
            AppendMenu 101,Fenster zeigen
            Separator
            AppendMenu 102,Ende
            ~GetCursorPos(Point#)
            ~MapWindowPoints(%Desktop,%hwnd,Point#,1)
            Trackmenu Point#.x&,Point#.y&
            Dispose Point#

        Endif

        If &ULParam = ~WM_LBUTTONDOWNlinker Mausbutton

            ~SetForegroundWindow(%hWnd)
            Dim Point#,Point
            CreateMenu
            AppendMenu 200,Linker Button 1
            AppendMenu 201,Linker Button 2
            Separator
            AppendMenu 202,Linker Button 3
            ~GetCursorPos(Point#)
            ~MapWindowPoints(%Desktop,%hwnd,Point#,1)
            Trackmenu Point#.x&,Point#.y&
            Dispose Point#

        Endif

    Endif

    If MenuItem(100)

        ~ShowWindow(%hwnd,~SW_HIDE)

    ElseIf Menuitem(101)

        SendMessage(%hwnd,~WM_SYSCOMMAND,~SC_RESTORE,0)

    ElseIf Menuitem(102)

        ~Shell_NotifyIcon(~NIM_DELETE,Note#)
        Ende& = 1

    Endif

Wend

 
07/15/07  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.870 Views

Untitledvor 0 min.
Georg Teles vor 30 Tagen
Alibre11/18/17
Kermit04/27/16
Torsten Boo08/11/13
More...

Themeninformationen

this Topic has 1 subscriber:

unbekannt (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie