i wrote an little application which does some operations in the background.
because it doesnt needs attention of the user, i want to send the application into system tray, and when someone clicks on it, the window should popup again.
the problem is, I've wrote an MFC program (dialog) which does everything I want it to do. And now i need to find a way to send it into the tray.
type: MFC (Dialog-Window) lnguage: C++ IDE: Visual Studio 2012
do you have any ideas of how i can do this? or do you maybe know a nice tutorial or the function/classes i need?
i already searched at codeprojects.com and google but there seems not to be much about this. thanks.
EDIT 1:
I tried something like this:
HWND hMainWindow = this->GetSafeHwnd();
HICON hProgramIcon = this->GetIcon(false);
char szTip[16] = "Tracker";
nidTrayIcon.cbSize = sizeof(nidTrayIcon);
nidTrayIcon.hIcon = hProgramIcon;
nidTrayIcon.hWnd = hMainWindow;
nidTrayIcon.uCallbackMessage = (WM_USER + 1);
nidTrayIcon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nidTrayIcon.uID = 0x0200;
strcpy_s((char*)nidTrayIcon.szTip,16, szTip2);
nidTrayIcon.szTip[strlen(szTip)] = '\0';
Shell_NotifyIcon(NIM_ADD, &nidTrayIcon);
If i run this code, my application shuts down with code "0x03" (Path not found ...)
EDIT 2:
this->ShowWindow(SW_HIDE);
also doesnt work. same problem.