| |
|
|
Jac de Lad | has someone one Quelltextschnipsel parat, with the I one vorhandenes Trayicon with a BalloonTip provided can? means of/ one, the aufpoppt, if I it bestimme, not if the user the Trayicon hovert?
Jac |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 01/04/08 ▲ |
|
|
|
|
Andreas Miethe
| CompileMarkSeparationAb Profan 7.0
#######################
Thema : Tray-Icon
Balloon-Tips
#######################
Andreas Miethe
August 2003
#######################
$H messages.ph
DEF HiWord(1) And(&(1)>>16,$FFFF)
DEF LoWord(1) And(&(1),$FFFF)
DEF GetFileVersionInfoSize(2) ! Version,GetFileVersionInfoSizeA
DEF GetFileVersionInfo(4) ! Version,GetFileVersionInfoA
DEF VerQueryValue(4) ! Version,VerQueryValueA
DEF GetSysColor(1) ! user32,GetSysColor
DEF SetWindowPos(7) ! User32,SetWindowPos
DEF LoadIcon(2) ! User32,LoadIconA
DEF Shell_NotifyIcon(2) ! shell32,Shell_NotifyIconA
DEF RegisterWindowMessage(1) ! user32,RegisterWindowMessageA
DEF SetForegroundWindow(1) ! user32,SetForegroundWindow
DEF GetCursorPos(1) ! user32,GetCursorPos
DEF MapWindowPoints(4) ! user32,MapWindowPoints
DEF XSetTimer(4) ! user32,SetTimer
DEF &WM_USER $0400
DEF &COLOR_BTNFACE 15
DEF &SWP_NOACTIVATE $10
DEF &SWP_NOREDRAW $8
DEF &NIF_ICON $2
DEF &NIF_TIP $4
DEF &NIF_MESSAGE $1
DEF &NIF_INFO $10
DEF &NIM_ADD $0
DEF &NIM_DELETE $2
DEF &NIM_MODIFY $1
DEF &NIM_SETVERSION $4
DEF &NIM_SETFOCUS $3
Icons
DEF &NIIF_ERROR $3
DEF &NIIF_INFO $1
DEF &NIIF_NONE $0
DEF &NIIF_WARNING $2
DEF &NIF_STATE $8
DEF &NIS_HIDDEN $1
DEF &NIS_SHAREDICON $2
DEF &NIN_BALLOONSHOW $0402
DEF &NIN_BALLOONHIDE $0403
DEF &NIN_BALLOONTIMEOUT $0404
DEF &NIN_BALLOONUSERCLICK $0405
DEF &WM_CLOSE $10
DEF &WM_LBUTTONDBLCLK $0203
DEF &WM_LBUTTONDOWN $0201
DEF &WM_RBUTTONDOWN $0204
DEF &WM_SYSCOMMAND $0112
DEF &SC_RESTORE $F120
DEF &WM_SHELLNOTIFY $0405 &WM_USER + 5 shell notify message
DEF &uID 7777
DEF &NOTIFYICONDATA_V1_SIZE 88 pre-5.0 structure size
DEF &NOTIFYICONDATA_V2_SIZE 488 pre-6.0 structure size
DEF &NOTIFYICONDATA_V3_SIZE 504 6.0+ structure size
Declare NOTIFYICONDATASIZE&
Proc IsShellVersion
Declare Retval&,K$
Declare nBufferSize&,nUnUsed&
Declare sDLLFile$
Declare lpBuffer#,lplpBuffer&,lpBufferLenght&
sDLLFile$ = Shell32
nBufferSize& = GetFileVersionInfoSize(addr(sDLLFile$), addr(nUnused&))
Dim lpBuffer#,nBufferSize&
GetFileVersionInfo(addr(sDLLFile$),0,nBufferSize&,lpBuffer#)
k$ = \
VerQueryValue(lpBuffer#,addr(k$),addr(lplpBuffer&),Addr(lpBufferLenght&))
RetVal& = Word(lplpBuffer&,10)
Dispose lpBuffer#
Return RetVal&
EndProc
Die Grösse der NotifyIcon- Struktur ist abhängig von der Version der
Shell32.dll, daher muss erst die Version geprüft werden.
IsShellVersion
If @&(0) = 5 Version = 5
NOTIFYICONDATASIZE& = &NOTIFYICONDATA_V2_SIZE
ElseIf @&(0) = 6 Version = 6
NOTIFYICONDATASIZE& = &NOTIFYICONDATA_V3_SIZE
Else Version = vor 5
NOTIFYICONDATASIZE& = &NOTIFYICONDATA_V1_SIZE
Endif
Declare Point#,TB_CREATED&
Declare InfoText$,InfoTitle$,Tip$,Icon$,RegMessage$
Tip$ = Balloon-Tips © Andreas Miethe * August 2003
InfoText$ = Dieses Tray-Icon reagiert auf die rechte wie auch auf die linke Maustaste
InfoText$ = InfoText$ +
+Tip$+chr$(0)
InfoTitle$ = INFO MAX 255 Zeichen
Icon$ =A
RegMessage$ = ToolbarCreated
Struct Point = x&, y&
Struct Note = cbSize&,hWnd&,uID&,uFlags&,uCallbackMessage&,hIcon&,szTip#(128),
dwState&,dwStateMask&,szInfo#(256),uTimeoutAndVersion&,szInfoTitle#(64),
dwInfoFlags&,guidItem#(16)
Declare Ende&,Note#
SetTrueColor 1
SetErrorlevel 0
Window -1000,0 - 0,0Fenster neben den Bildschirm
CLS GetSysColor(&COLOR_BTNFACE)
ShowWindow(%hwnd,0)Fenster verbergen
SetWindowPos(%hwnd,0,0,0,640,480,OR(&SWP_NOREDRAW,&SWP_NOACTIVATE))neue Position
Dim Note#,Note
Clear Note#
Note#.cbSize& = NOTIFYICONDATASIZE&
Note#.hWnd& = %hwnd
Note#.uID& = &uID
Note#.hIcon& = LoadIcon(%hInstance,ADDR(Icon$))
Note#.uFlags& = Or(Or(Or(&NIF_ICON,&NIF_TIP),&NIF_MESSAGE),&NIF_STATE)
Note#.uCallbackMessage& = &WM_SHELLNOTIFY
Note#.szTip# = Tip$
Note#.dwState& = &NIS_SHAREDICON
Note#.dwStateMask& = Or(&NIS_HIDDEN,&NIS_SHAREDICON)
Note#.uTimeoutAndVersion& = 50$3
normales Icon einfügen
Shell_NotifyIcon(&NIM_ADD, Note#)
Shell_NotifyIcon(&NIM_SETVERSION, Note#)
modifizieren für Balloon-Tips
Note#.uFlags& = &NIF_INFO
Note#.szInfo# = InfoText$
Note#.szInfoTitle# = InfoTitle$
Note#.dwInfoFlags& = &NIIF_INFO
Note#.uTimeoutAndVersion& = 16000TimeOut
Shell_NotifyIcon(&NIM_MODIFY,Note#)
TB_CREATED& = RegisterWindowMessage(ADDR(RegMessage$))
UserMessages &WM_SHELLNOTIFY,TB_CREATED&,&WM_CLOSE,~WM_NOTIFY
ShowWindow(%hwnd,0)
settimer 15000
Whilenot Ende&
Waitinput
If %wmTimer
Umweg falls MinTimeOut größer als 15 sekunden ist
Killtimer
Note#.szInfo# = chr$(0)
Note#.szInfoTitle# = chr$(0)
Shell_NotifyIcon(&NIM_MODIFY,Note#)
MessageBox(Zeit abgelaufen,,0)
Print Zeit abgelaufen
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 = &NIN_BALLOONTIMEOUT
Killtimer
MessageBox(Zeit abgelaufen,,0)
Print Zeit abgelaufen
Endif
If &ULParam = &NIN_BALLOONUSERCLICK
MessageBox(Klick,,0)
Print Klick
Endif
If &ULParam = &NIN_BALLOONHIDE
MessageBox(weg,,0)
Print weg
Endif
If &ULParam = &WM_RBUTTONDOWNrechter Mausbutton
SetForegroundWindow(%hWnd)
Dim Point#,Point
CreateMenu
AppendMenu 100,Fenster verbergen
AppendMenu 101,Fenster zeigen
Separator
AppendMenu 102,Ende
AppendMenu 103,PopUp
GetCursorPos(Point#)
MapWindowPoints(%Desktop,%hwnd,Point#,1)
Trackmenu Point#.x&,Point#.y&
Dispose Point#
Endif
If &ULParam = &WM_LBUTTONDBLCLKlinker 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,0)
ElseIf Menuitem(101)
SendMessage(%hwnd,&WM_SYSCOMMAND,&SC_RESTORE,0)
ElseIf Menuitem(102)
Shell_NotifyIcon(&NIM_DELETE,Note#)
Ende& = 1
elseif MenuItem(103)
Shell_NotifyIcon(&NIM_MODIFY,Note#)Balloontip anzeigen
ElseIf Menuitem(200)
settimer 15000
Shell_NotifyIcon(&NIM_MODIFY,Note#)Balloontip anzeigen
Endif
If %key = 32
Shell_NotifyIcon(&NIM_MODIFY,Note#)Balloontip Show
Endif
Wend
|
|
|
| Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...] | 01/04/08 ▲ |
|
|
|
|
Jac de Lad | but the created still the Trayicon with. I meant, if the Icon already present is and only the Text time even aufploppen should. |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 01/04/08 ▲ |
|
|
|
|
Andreas Miethe
| Yes clear,
TrayIcon and Balloontip go together created. differently goes not. everything what differently walk should, must You by hand yourself make. Tooltips ( the Balloontip is Yes nothing other ) belong now time To designed Controls. |
|
|
| Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...] | 01/04/08 ▲ |
|
|
|
|
Jac de Lad | Hm, with others Programs goes it too. i know too How I a new Text allocate can, but I brauchs even without new Icon. thanks, I look me time circa, is already somehow klappen. |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 01/04/08 ▲ |
|
|
|
|
Jac de Lad | Ah, now. If one The important pieces rauskopiert works.
Thank you! |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 08/22/08 ▲ |
|
|
|