Hi! I wanna create a icon in the tray that should popup balloon-messages. Here's my code in the WM_CREATE:


; Initzalise commoncontrols...
        mov CCStruct.dwSize, sizeof INITCOMMONCONTROLSEX
mov CCStruct.dwICC, ICC_TREEVIEW_CLASSES+ICC_BAR_CLASSES
invoke InitCommonControlsEx, addr CCStruct

; Create trayicon...
mov TrayIcon.cbSize, sizeof NOTIFYICONDATAB
push hWnd
pop TrayIcon.hwnd
mov TrayIcon.uID, IDI_TRAY
mov TrayIcon.uFlags, NIF_ICON+NIF_MESSAGE+NIF_TIP
mov TrayIcon.uCallbackMessage, WM_SHELLNOTIFY
invoke LoadIcon, NULL, IDI_WINLOGO
mov TrayIcon.hIcon, eax
invoke lstrcpy, addr TrayIcon.szTip,addr szHost
invoke Shell_NotifyIcon, NIM_ADD, addr TrayIcon

mov TrayIcon.uFlags, 00000010h    ;010h is the NIF_INFO
mov TrayIcon.uTimeout, 2000
mov TrayIcon.uVersion, 3 ; NOTIFYICON_VERSION
mov TrayIcon.dwInfoFlags, 00000001h ;
invoke lstrcpyn, addr TrayIcon.szInfo, addr szUrl, 256
invoke Shell_NotifyIcon, NIM_MODIFY, addr TrayIcon


I get a trayicon with a tooltip if I hold the pointer over it, but no balloon.
And well if you noticed, I use NOTIFYICONDATAB - a structure that I created on my own from the VC++ includes, so I can use the "extended"-version with szInfo. It looks like this:

NOTIFYICONDATAB STRUCT
  cbSize            DWORD      ?
  hwnd              DWORD      ?
  uID              DWORD      ?
  uFlags            DWORD      ?
  uCallbackMessage  DWORD      ?
  hIcon            DWORD      ?
  szTip            BYTE 128 dup (?)

  dwState     DWORD ?
  dwStateMask DWORD ?
  szInfo BYTE 256 dup (?)
  uTimeout DWORD ?
  uVersion DWORD ?
  szInfoTitle BYTE 64 dup (?)
  dwInfoFlags DWORD ?
NOTIFYICONDATAB ENDS
Posted on 2005-07-24 18:14:56 by _Christopher
Shell_NotifyIcon requires NOTIFYICONDATA structure, which is:

typedef struct _NOTIFYICONDATA {
    DWORD cbSize;
    HWND hWnd;
    UINT uID;
    UINT uFlags;
    UINT uCallbackMessage;
    HICON hIcon;
    TCHAR szTip[64];
    DWORD dwState;
    DWORD dwStateMask;
    TCHAR szInfo[256];
    union {
        UINT uTimeout;
        UINT uVersion;
    };
    TCHAR szInfoTitle[64];
    DWORD dwInfoFlags;
    GUID guidItem;
} NOTIFYICONDATA, *PNOTIFYICONDATA;

GUID is 16 bytes, CHAR is a byte, everything else is a dword.

Union here makes the uTimeout and uVersion occupy same space, so you need to use an union, or only 1 of them.
Posted on 2005-07-24 18:40:38 by ti_mo_n
Okey, I changed my structure to this, with no luck:
NOTIFYICONDATAB STRUCT
  cbSize            DWORD      ?
  hwnd              DWORD      ?
  uID              DWORD      ?
  uFlags            DWORD      ?
  uCallbackMessage  DWORD      ?
  hIcon            DWORD      ?
  szTip            BYTE 64 dup (?)

  dwState     DWORD ?
  dwStateMask DWORD ?
  szInfo BYTE 256 dup (?)
  uTimeout DWORD ?
  szInfoTitle BYTE 64 dup (?)
  dwInfoFlags DWORD ?
  guidItem DWORD 4 dup (?)
NOTIFYICONDATAB ENDS
Posted on 2005-07-24 19:09:32 by _Christopher
actually there's different structs, relative to the version of tooltips you 'request', which makes it a total mess, i messed with it before by disassembling some programs in windows that use the balloon tip stuff, i shall post the code later on (havent got it handy atm)
Posted on 2005-07-24 19:35:59 by evlncrn8
Okey evlncrn8, I'll wait for your code then. I've been messing with this for hours today :/
Posted on 2005-07-24 19:43:48 by _Christopher