| |
|
|
|
Source wurde am 15.07.2007 aus qui MMJ-Quellcodesammlung (Dietmar Horn) dans qui Babyklappe sur XProfan.Com abgelegt:
Tray-Icon erstellen et abfragen (linke et rechte Bouton de la souris)
#######################
Thema : Tray-Icon
#######################
Andreas Miethe
août 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
Déclarer Point#,TB_CREATED&
Déclarer Ende&,Note#,Tip$
SetTrueColor 1
Fenêtre %maxx,0 - 640,480la fenêtre près de den Bildschirm
CLS ~GetSysColor(~COLOR_BTNFACE)
~ShowWindow(%hwnd,~SW_HIDE)la fenêtre cacher
~SetWindowPos(%hwnd,0,0,0,640,480,OU(~SWP_NOREDRAW,~SWP_NOACTIVATE))neue Position
Faible Note#,Note
Claire 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)
Utilisateur Messages &WM_SHELLNOTIFY,TB_CREATED&,~WM_CLOSE
Whilenot Ende&
Waitinput
Si ~IsIconic(%hwnd)la fenêtre minimiert ??
~ShowWindow(%hwnd,~SW_HIDE)
Endif
Si %UMessage = ~WM_CLOSE
~Shell_NotifyIcon(~NIM_DELETE,Note#)
Ende& = 1
Endif
Si %UMessage = TB_CREATED&Explorer-Crash. Icon récente anlegen
~Shell_NotifyIcon(~NIM_ADD,Note#)
Endif
Si %UMessage = &WM_SHELLNOTIFY
Si &ULParam = ~WM_RBUTTONDOWNrechter Mausbutton
~SetForegroundWindow(%hWnd)
Faible Point#,Point
CreateMenu
AppendMenu 100,la fenêtre cacher
AppendMenu 101,la fenêtre montrer
Séparateur
AppendMenu 102,Ende
~GetCursorPos(Point#)
~MapWindowPoints(%Desktop,%hwnd,Point#,1)
Trackmenu Point#.x&,Point#.y&
Dispose Point#
Endif
Si &ULParam = ~WM_LBUTTONDOWNlinker Mausbutton
~SetForegroundWindow(%hWnd)
Faible Point#,Point
CreateMenu
AppendMenu 200,Linker Button 1
AppendMenu 201,Linker Button 2
Séparateur
AppendMenu 202,Linker Button 3
~GetCursorPos(Point#)
~MapWindowPoints(%Desktop,%hwnd,Point#,1)
Trackmenu Point#.x&,Point#.y&
Dispose Point#
Endif
Endif
Si 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
|
|
|
| |
|
|