I want to minimize my program to the system tray, and then I have 3 things I want the program to do :
1) If I'll put my mouse on it, it'll show some text near it(like when u put a mouse near the Internet Icon and it tells you you'r Network SSID... 2) If I'll right click on the icon in the system tray, X will happen 3) if I'll left click on the icon in the system tray, Y will happen
I minimize my program to the system tray using this code :
void MinimizeSystemTray(HWND hwnd)
{
NOTIFYICONDATA nid;
nid.cbSize = sizeof(nid);
nid.hWnd = hwnd;
nid.hIcon = LoadIcon(0, IDI_APPLICATION);
nid.uCallbackMessage = WM_USER;
nid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
ShowWindow(hwnd, SW_HIDE);
Shell_NotifyIcon(NIM_ADD, &nid);
}
It works great, though I couldent find solution for the 3 problems I had...
Thanks!
Read the documentation more carefully. Everything you are asking for is covered by it.
You are already using NIF_TIP
and NIF_MESSAGE
, which allow you to provide the popup text on mouse hover (#1), and tell the System Tray what window message to send back to your HWND when the user clicks on your icon (#2 and #3), respectively. That message contains all the information you need to know to differentiate between mouse hovering vs left/right mouse buttons vs spacebar key pressing.