I'm trying to use this:
Code: Select all
; For systray notifications
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
Structure _NotifyIconData
cbSize.l
PB_Alignment1.b[4]
hWnd.i
uId.l
uFlags.l
uCallbackMessage.l
PB_Alignment2.b[4]
hIcon.i
szTip.s{128}
dwState.l
dwStateMask.l
szInfo.s{256}
StructureUnion
uTimeout.l
uVersion.l
EndStructureUnion
szInfoTitle.s{64}
dwInfoFlags.l
guidItem.GUID
hBalloonIcon.i
EndStructure
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x86
Structure _NotifyIconData
cbSize.l
hwnd.i
uId.l
uFlags.l
uCallbackMessage.l
hIcon.i
szTip.s{128}
dwState.l
dwStateMask.l
szInfo.s{256}
StructureUnion
uTimeout.l
uVersion.l
EndStructureUnion
szInfoTitle.s{64}
dwInfoFlags.l
guidItem.GUID
hBalloonIcon.i
EndStructure
CompilerEndIf
; *************************************************************************************************
; This was taken from the !WinAPI library tool
; Possible flags, e.g.: #NIIF_ERROR, #NIIF_INFO, #NIIF_USER, #NIIF_WARNING
; For a user defined icon, #NIIF_USER and the belonging hIcon must be passed!
; timeOut in milliseconds
Procedure ShowTrayNotification(trayIconID, windowID, title.s, message.s, timeOut, flags, hIcon=0)
Protected nId._NotifyIconData
If OSVersion() >= #PB_OS_Windows_Vista
nId\cbSize = SizeOf(_NotifyIconData)
ElseIf OSVersion() >= #PB_OS_Windows_XP
nId\cbSize = 504
ElseIf OSVersion() >= #PB_OS_Windows_2000
nId\cbSize = 488
Else
nId\cbSize = 88
EndIf
If nId\cbSize
nId\uVersion = 4
Shell_NotifyIcon_(#NIM_SETVERSION, @nId)
nId\uId = trayIconID
nId\hWnd = windowID
If OSVersion() >= #PB_OS_Windows_Vista
nId\hBalloonIcon = hIcon
Else
nId\hIcon = hIcon
EndIf
nId\dwInfoFlags = flags
nId\uFlags = #NIF_INFO
nId\uTimeout = timeOut
nId\szInfo = message
PokeS(@nId\szInfo, message)
PokeS(@nId\szInfoTitle, title)
ProcedureReturn Shell_NotifyIcon_(#NIM_MODIFY, @nId)
EndIf
ProcedureReturn #False
EndProcedure
Code: Select all
If FileSize(iconFile) > 0
If LoadImage(#IconID, iconFile)
hIcon = ImageID(#IconID)
EndIf
EndIf
ShowTrayNotification(#TrayIcons_Main, WindowID(#Win_Main), title, message, timeout, #NIIF_USER, hIcon)
If the .ico file contains more than one icon (with different sizes): No tray notification gets displayed and the same is true if the .ico contains a (single) different sized icon (anything else than 16x16 px)...
Is there a way to get this working even if the .ico file contains more than one icon and for .ico files with
only one but a different size (e.g. by automatically rescaling them)?