[quote="nooc"]WM_SYSCOMMAND is send when minimizing the window. Check for wParam == SC_MINIMIZE in the callback.[/quote] Actually, I just found that 5 minutes ago and got it to work. But, now I have another problem. This is the code I used in my message loop: [code]case WM_SYSCOMMAND: { if(wParam == SC_MINIMIZE) { ShowWindow(hWnd, SW_HIDE); } break; }[/code] The window doesn't stay hidden. It just reappears on the taskbar minimized. Any ideas why? Edit: I fixed that, now I have another problem :roll: The message queue seems to not respond to the CallbackMessage variable I set, so it doesn't want to tell me if I clicked on the icon or double clicked it, ect. Edit 2: This appears to be the case. I read a bunch of examples on CodeProject and re-read several things on MSDN with no results. I added a popup that will state if the tray icon sent any messages to the queue. Here is my code if anyone is willing to take a look: [code]// include the basic windows header file #include #include #include #include "resource.h" #define WM_TRAYMESSAGE WM_APP+10 // for NOTIFYICONDATA NOTIFYICONDATA nid; // the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // the handle for the window, filled by a function HWND hWnd; // this struct holds information for the window class WNDCLASSEX wc; // clear out the window class for use ZeroMemory(&wc, sizeof(WNDCLASSEX)); // fill in the struct with the needed information wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)COLOR_WINDOW; wc.lpszClassName = "WindowClass1"; // register the window class RegisterClassEx(&wc); // create the window and use the result as the handle hWnd = CreateWindowEx(WS_EX_NOINHERITLAYOUT, "WindowClass1", // name of the window class "Window Title LAWL", // title of the window WS_OVERLAPPEDWINDOW, // window style 300, // x-position of the window 300, // y-position of the window 500, // width of the window 400, // height of the window NULL, // we have no parent window, NULL NULL, // we aren't using menus, NULL hInstance, // application handle NULL); // used with multiple windows, NULL // fill the struct for NOTIFYICONDATA with the needed info nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = hWnd; nid.uID = 0; nid.uFlags = NIF_ICON | NIF_TIP; nid.uCallbackMessage = WM_TRAYMESSAGE; HICON hIco = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON)); nid.hIcon = hIco; strncpy( nid.szTip, "App name", 64 ); // display the window on the screen ShowWindow(hWnd, nCmdShow); Shell_NotifyIcon(NIM_ADD, &nid); if(hIco) { DestroyIcon(hIco); } // enter the main loop: // this struct holds Windows event messages MSG msg; // wait for the next message in the queue, store the result in 'msg' while(GetMessage(&msg, NULL, 0, 0)) { // translate keystroke messages into the right format TranslateMessage(&msg); // send the message to the WindowProc function DispatchMessage(&msg); } // return this part of the WM_QUIT message to Windows return msg.wParam; } // this is the main message handler for the program LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { // sort through and find what code to run for the message given switch(message) { // this message is read when the window is closed case WM_DESTROY: { // close the application entirely Shell_NotifyIcon(NIM_DELETE, &nid); PostQuitMessage(0); return 0; } break; case WM_TRAYMESSAGE: { MessageBox(NULL, "LIAR", "You can't see me!", MB_ICONEXCLAMATION | MB_OK); if(LOWORD(lParam) == WM_LBUTTONUP) { Shell_NotifyIcon(NIM_DELETE, &nid); } } break; case WM_SIZE: { if(wParam == SIZE_MINIMIZED) { ShowWindow(hWnd, SW_HIDE); } } break; } // Handle any messages the switch statement didn't return DefWindowProc (hWnd, message, wParam, lParam); }[/code] Yeah, it's a bit messy, but I'm trying to just get this blasted thing to work right before I do any extra work. Take note of the dialog box. That doesn't show up when I click the icon or put the mouse over it, or anything. Thanks in advance if anyone has any ideas.