Question

Im having issues with balloons firstly they refused to show at all but having found this thread:

Why aren't Shell_NotifyIcon balloon tips working?

then changing cbSize to 504 the balloons show but without icons in them, all the standard icons won't show nor will a custom icon, structure looks like this:

 cbSize = 504
 hWnd = HDL
 uID = 10
 uFlags = NIF_INFO
 szInfo = sBody
 uTimeout = 20000
 szInfoTitle = sTitle
 dwInfoFlags = NIIF_ERROR

does anyone know of a reason why the icons will fail? (Have tried all the structure sizes and uVersion in the various combinations)

Edit:

S.cbSize = 504;
S.hWnd = HDL;
S.uID = 101;
S.uFlags = NIF_MESSAGE + NIF_ICON + NIF_TIP;
S.uCallbackMessage = 0x4DE;
S.hIcon = iHDL;
S.szTip = sTooltip;
S.uVersion = 3;
S.dwInfoFlags = NIIF_NONE;
Shell32.Shell_NotifyIconA(NIM_ADD,S:GetPointer())
Shell32.Shell_NotifyIconA(NIM_SETVERSION,S:GetPointer())

That's used to create the tray icon and it does:

enter image description here

All the callback messages work with the change tooltip/change icon/set focus/delete tray icon functions also working as expected on XP and Win 8.1 all using cbSize = 504 and uVersion = 3 with Ansi NIM_SETVERSION and NOTIFYICONDATA, balloons will show its just no icons will show not even the default ones:

S.cbSize = 504;
S.hWnd = HDL
S.uID = 101
S.uFlags = NIF_INFO
S.szInfo = sBody
S.uTimeout = 20000
S.szInfoTitle = sTitle
S.dwInfoFlags = NIIF_ERROR
Shell32.Shell_NotifyIconA(NIM_MODIFY,S:GetPointer())

enter image description here

Using size of structure for cbSize works for everything but balloons, they wont even show, and that size reports as 688.

Était-ce utile?

La solution

cbSize=504 is only meaningful if you are using the Ansi versions of Shell_NotifyIcon() and NOTIFYICONDATA, are using the XP (v3) version of NOTIFYICONDATA, and your compiler's alignment settings are actually aligning the NOTIFYICONDATA fields correctly so the XP fields line up to exactly 504 bytes. Without seeing your actual code, your compiler settings, or any context information at all, there is no way to troubleshoot your problem further.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top