| |
|
|
|
Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) in The Babyklappe on XProfan.Com stored:
Tray-Icon create and inquire (left and rights Mouse button)
#######################
Topic : 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#,hint$
SetTrueColor 1
Window %maxx,0 - 640,480Window next to whom screen
CLS ~GetSysColor(~COLOR_BTNFACE)
~ShowWindow(%hwnd,~SW_HIDE)Window hide
~SetWindowPos(%hwnd,0,0,0,640,480,OR(~SWP_NOREDRAW,~SWP_NOACTIVATE))new 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 demonstration
~Shell_NotifyIcon(~NIM_ADD, note#)
TB_CREATED& = ~RegisterWindowMessage(IconCreated)
User Messages &WM_SHELLNOTIFY,TB_CREATED&,~WM_CLOSE
Whilenot Ende&
Waitinput
If ~IsIconic(%hwnd)Window minimizes ??
~ShowWindow(%hwnd,~SW_HIDE)
Endif
If %UMessage = ~WM_CLOSE
~Shell_NotifyIcon(~NIM_DELETE,note#)
Ende& = 1
Endif
If %UMessage = TB_CREATED&Explorer-Crash. Icon new lay out
~Shell_NotifyIcon(~NIM_ADD,note#)
Endif
If %UMessage = &WM_SHELLNOTIFY
If &ULParam = ~WM_RBUTTONDOWNrechter Mausbutton
~SetForegroundWindow(%hWnd)
Dim Point#,Point
CreateMenu
AppendMenu 100,Window hide
AppendMenu 101,Window show
Separator
AppendMenu 102,end
~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
|
|
|
| |
|
|