No Balloon Tip
-
hi, I want to display a little balloon tip on my tray icon but the balloon just won't appear, although the tray icon is visible. the app is based on MFC and here's the code that doesn't work. it is located in OnInitDialog:
ndata.cbSize=sizeof(NOTIFYICONDATA); ndata.hWnd = m_hWnd; ndata.uFlags = NIF_ICON | NIF_MESSAGE | NIF_INFO; ndata.uID = IDI_DISABLED; ndata.dwInfoFlags = NIIF_NONE; ndata.hIcon = (HICON) LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_DISABLED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ndata.uCallbackMessage = WM_POPUP; ndata.uTimeout = 10000; wcscpy(ndata.szInfoTitle,_T("Test")); wcscpy(ndata.szInfo, _T("Test")); Shell_NotifyIcon(NIM_ADD, &ndata);
ndata is of type NOTIFYICONDATA and is a member of my dialog class. any clues what could be wrong with that ? greets -- modified at 4:38 Wednesday 1st February, 2006 -
hi, I want to display a little balloon tip on my tray icon but the balloon just won't appear, although the tray icon is visible. the app is based on MFC and here's the code that doesn't work. it is located in OnInitDialog:
ndata.cbSize=sizeof(NOTIFYICONDATA); ndata.hWnd = m_hWnd; ndata.uFlags = NIF_ICON | NIF_MESSAGE | NIF_INFO; ndata.uID = IDI_DISABLED; ndata.dwInfoFlags = NIIF_NONE; ndata.hIcon = (HICON) LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_DISABLED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ndata.uCallbackMessage = WM_POPUP; ndata.uTimeout = 10000; wcscpy(ndata.szInfoTitle,_T("Test")); wcscpy(ndata.szInfo, _T("Test")); Shell_NotifyIcon(NIM_ADD, &ndata);
ndata is of type NOTIFYICONDATA and is a member of my dialog class. any clues what could be wrong with that ? greets -- modified at 4:38 Wednesday 1st February, 2006You have to set the version.
ndata.uVersion=NOTIFYICON_VERSION; Shell_NotifyIcon(NIM_SETVERSION, &nData);
Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
-
You have to set the version.
ndata.uVersion=NOTIFYICON_VERSION; Shell_NotifyIcon(NIM_SETVERSION, &nData);
Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
... no effect. setting the version didn't fix it :(
-
... no effect. setting the version didn't fix it :(
Where did you do it. Note:
uTimeout
anduVersion
is wrapped inside aunion
so you must be careful. Both cannot be used at once.Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
-
Where did you do it. Note:
uTimeout
anduVersion
is wrapped inside aunion
so you must be careful. Both cannot be used at once.Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
right after
ndata.cbSize = sizeof(NOTIFYICONDATA);
-
right after
ndata.cbSize = sizeof(NOTIFYICONDATA);
No you are wrong. First set the icon:
Shell_NotifyIcon(NIM_ADD, &ndata);
Then the set the version:
ndata.uVersion = NOTIFYICON_VERSION; Shell_NotifyIcon(NIM_SETVERSION, &ndata);
The reason being that you cannot use both
uVersion
anduTimeout
together since they are wrapped inside aunion
.Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
-
right after
ndata.cbSize = sizeof(NOTIFYICONDATA);
The code that you gave is working here, with the following modifications... _tcscpy(ndata.szInfoTitle,_T("Test")); _tcscpy(ndata.szInfo, _T("Test"));
Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
-
The code that you gave is working here, with the following modifications... _tcscpy(ndata.szInfoTitle,_T("Test")); _tcscpy(ndata.szInfo, _T("Test"));
Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
ok here's my new code:
ZeroMemory(&ndata, sizeof(NOTIFYICONDATA)); ndata.cbSize = sizeof(NOTIFYICONDATA); ndata.hWnd = m_hWnd; ndata.uFlags = NIF_ICON | NIF_MESSAGE; ndata.uID = IDI_DISABLED; ndata.uCallbackMessage = WM_POPUP; ndata.hIcon = (HICON) LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_DISABLED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); Shell_NotifyIcon(NIM_ADD, &ndata); ndata.uVersion = NOTIFYICON_VERSION; Shell_NotifyIcon(NIM_SETVERSION, &ndata); ndata.uTimeout = 10000; ndata.uFlags |= NIF_INFO; _tcscpy(ndata.szInfoTitle,_T("Test")); _tcscpy(ndata.szInfo, _T("Test")); Shell_NotifyIcon(NIM_MODIFY, &ndata);
but still no balloon :wtf: -
ok here's my new code:
ZeroMemory(&ndata, sizeof(NOTIFYICONDATA)); ndata.cbSize = sizeof(NOTIFYICONDATA); ndata.hWnd = m_hWnd; ndata.uFlags = NIF_ICON | NIF_MESSAGE; ndata.uID = IDI_DISABLED; ndata.uCallbackMessage = WM_POPUP; ndata.hIcon = (HICON) LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_DISABLED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); Shell_NotifyIcon(NIM_ADD, &ndata); ndata.uVersion = NOTIFYICON_VERSION; Shell_NotifyIcon(NIM_SETVERSION, &ndata); ndata.uTimeout = 10000; ndata.uFlags |= NIF_INFO; _tcscpy(ndata.szInfoTitle,_T("Test")); _tcscpy(ndata.szInfo, _T("Test")); Shell_NotifyIcon(NIM_MODIFY, &ndata);
but still no balloon :wtf:You don't need to modify anything .... Yeah Because szInfo is
TCHAR
andszInfoTitle
is alsoTCHAR
so you must use_tcscpy
to copy strings... You can use the original code with the modifications that I told. i.e. Replacewcscpy
with_tcscpy
Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
-
ok here's my new code:
ZeroMemory(&ndata, sizeof(NOTIFYICONDATA)); ndata.cbSize = sizeof(NOTIFYICONDATA); ndata.hWnd = m_hWnd; ndata.uFlags = NIF_ICON | NIF_MESSAGE; ndata.uID = IDI_DISABLED; ndata.uCallbackMessage = WM_POPUP; ndata.hIcon = (HICON) LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_DISABLED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); Shell_NotifyIcon(NIM_ADD, &ndata); ndata.uVersion = NOTIFYICON_VERSION; Shell_NotifyIcon(NIM_SETVERSION, &ndata); ndata.uTimeout = 10000; ndata.uFlags |= NIF_INFO; _tcscpy(ndata.szInfoTitle,_T("Test")); _tcscpy(ndata.szInfo, _T("Test")); Shell_NotifyIcon(NIM_MODIFY, &ndata);
but still no balloon :wtf:I did set the IE version to 0x0500
#define _WIN32_IE 0x0500 ndata.cbSize=sizeof(NOTIFYICONDATA); ndata.hWnd = m_hWnd; ndata.uFlags = NIF_ICON | NIF_MESSAGE | NIF_INFO; ndata.uID = 123; ndata.dwInfoFlags = NIIF_ERROR; ndata.hIcon = (HICON) LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ndata.uCallbackMessage = 0; ndata.uTimeout = 10000; _tcscpy(ndata.szInfoTitle,_T("Test")); _tcscpy(ndata.szInfo, _T("Test")); Shell_NotifyIcon(NIM_ADD, &ndata);
This works...
Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
-
I did set the IE version to 0x0500
#define _WIN32_IE 0x0500 ndata.cbSize=sizeof(NOTIFYICONDATA); ndata.hWnd = m_hWnd; ndata.uFlags = NIF_ICON | NIF_MESSAGE | NIF_INFO; ndata.uID = 123; ndata.dwInfoFlags = NIIF_ERROR; ndata.hIcon = (HICON) LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ndata.uCallbackMessage = 0; ndata.uTimeout = 10000; _tcscpy(ndata.szInfoTitle,_T("Test")); _tcscpy(ndata.szInfo, _T("Test")); Shell_NotifyIcon(NIM_ADD, &ndata);
This works...
Jesus Lives Forever - Amen:rose:
--Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:
yesss. that's it. i forgot the #define. ok man thank you! i appreciate your efforts!