Icon: Tray-Icon erzeugen und abfragen



'Icon: Tray-Icon erzeugen und abfragen

Beitrag, 16.07.2007 00:08: ;createCode() 'Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt: 'Icon: Tray-Icon erzeugen und abfragen '####################### '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,480'Fenster 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_RBUTTONDOWN'rechter 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_LBUTTONDOWN'linker 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


Dies ist die Offlinevariante vom Thread [Icon: Tray-Icon erzeugen und abfragen].

Valid CSS!

©2006 XProfan.Com