I'm having a bit of trouble with this code, the weird thing is it did work and when I went to work on it the next day it didn't work and I dont remember changing anything, which is really annoying. I even have a working exe of the code. The code should add a little balloon icon to the icon in the sys tray when the procedure is called.
This is the structure that I am useing, as far as I can see it is correct.
Code: Select all
OpenLibrary(0,"shell32.dll")
;Konstanten
#TRAY_ID = 999
#NIM_ADD = $0
#NIM_MODIFY = $1
#NIM_DELETE = $2
#NIF_MESSAGE = $1
#NIF_ICON = $2
#NIF_TIP = $4
#NIF_INFO = $10
#NIF_STATE = $8
#NIS_SHAREDICON = $2
#NIIF_INFO = $1
#NIIF_WARNING = $2
#NIIF_ERROR = $3
#NIIF_NOSOUND = $10
#NOTIFYICON_VERSION = $3
;NOTIFYICONDATA Struktur
Structure IconData
cbSize.l
hwnd.l
uID.l
uFlags.l
uCallbackMessage.l
hIcon.l
szTip.b[128]
dwState.l
dwStateMask.l
szInfo.b[256]
StructureUnion
uTimeout.l
uVersion.l
EndStructureUnion
szInfoTitle.b[64]
dwInfoFlags.l
EndStructure
Code: Select all
TrayIcon.l = AddSysTrayIcon(#PB_Any,WindowID(),CatchImage(0,?Icon))Code: Select all
Procedure BalloonIcon(title.s,maintext.s)
Balloon.IconData\cbSize=SizeOf(IconData)
Balloon\hwnd = WindowID(#Window_0)
Balloon\uID = Random(999)
Balloon\uFlags = #NIF_MESSAGE | #NIF_ICON | #NIF_TIP | #NIF_INFO
Balloon\hIcon = TrayIcon
Balloon\dwState = #NIS_SHAREDICON
If OSVersion() < #PB_OS_Windows_2000
Balloon\uVersion = 0
Else
Balloon\uVersion = #NOTIFYICON_VERSION
EndIf
Balloon\uTimeout = 15000
Balloon\dwInfoFlags = #NIIF_INFO
PokeS(@Balloon\szTip, "TV Alarm - Alarm Event")
PokeS(@Balloon\szInfo,maintext.s)
PokeS(@Balloon\szInfoTitle,title.s)
;Debug CallFunction(0,"Shell_NotifyIcon",#NIM_ADD,@Balloon)
;Aufpoppen lassen des ToolTips
Debug "Window ID: "+Str(Balloon\hwnd)
Debug "Balloon ID: "+Str(Balloon\uID)
Debug "Balloon Flags: "+Str(Balloon\uFlags)
Debug "Balloon Tip: "+PeekS(@Balloon\szTip)
Debug "Balloon Icon Handle: "+Str(Balloon\hIcon)
Debug "Balloon State: "+Str(Balloon\dwState)
Debug "Balloon Version: "+Str(Balloon\uVersion)
Debug "Balloon Main Text: "+PeekS(@Balloon\szInfo)
Debug "Balloon Title: "+PeekS(@Balloon\szInfoTitle)
Debug "Balloon Timeout: "+Str(Balloon\uTimeout)
Debug "Ballon dwInfoFlags: "+Str(Balloon\dwInfoFlags)
Debug CallFunction(0,"Shell_NotifyIcon",#NIM_MODIFY,@Balloon)
EndProcedure
Thanks
