I need help. I want to be able to put an application icon in the task tray to restore an application, but i have no clue where to start. I researched the topic on the MSDN, but they aren't very clear about things and i got completely lost. Here is some code i came up with to do this.
Code:
#include <windows.h>
#include <shellapi.h>
#include <iostream>
#include <WindowClasses.h>
#include <string.h>

#define TASKBAR_RESTORE 0x2000
#define _WIN32_IE 0x0600

using namespace std;

LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
 cout << msg;

 switch (msg)
 {
  case WM_CLOSE:

       DestroyWindow (hwnd);
       break;

  case WM_DESTROY:

       PostQuitMessage(0);
       break;
  
  case TASKBAR_RESTORE:

       MessageBox (NULL, "I'm doing stuff in the task bar", "HEY!!!", MB_OK);

       switch (lParam)
       {
        case WM_CONTEXTMENU:
       
         MessageBox (NULL, "The Mouse moved!!!", "HEY!!!", MB_OK);
         PostMessage (hwnd, SW_SHOW, 0, 0);
         break;
       }

  default:
  
       return DefWindowProc (hwnd, msg, wParam, lParam);
 }
 cout << msg;

 return 0;
}
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
 WINDOW window;
 MSG Msg;
 NOTIFYICONDATA icon_dat;
 InitWindowClasses (hInstance);

 // initialize icon data

 icon_dat.cbSize           = sizeof (NOTIFYICONDATA);
 icon_dat.hWnd             = window.GetHandle();
 icon_dat.uID              = 10;
 icon_dat.uFlags           = NIF_MESSAGE | NIF_ICON;
 icon_dat.uCallbackMessage = TASKBAR_RESTORE;
 icon_dat.hIcon            = LoadIcon (NULL, IDI_APPLICATION);

 window.MakeWindow ("Test Window", 200, 200, 200, 200, WndProc);
 ShowWindow (window.GetHandle(), SW_SHOW);
 UpdateWindow (window.GetHandle());

 Shell_NotifyIcon (NIM_ADD, &icon_dat);

 while(GetMessage(&Msg, NULL, 0, 0) > 0)
 {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
 }
 return Msg.wParam;
}
the class window is in a different header if you need that too:

Code:
#ifndef WINDOW_CLASSES_H
#define WINDOW_CLASSES_H

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

LRESULT CALLBACK Default (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
}

HWND defaultWnd;
HINSTANCE instance;

int InitWindowClasses (HINSTANCE progInstance)
{
 WNDCLASSEX wc;

 instance = progInstance;

 wc.cbSize        = sizeof(WNDCLASSEX);
 wc.style         = 0;
 wc.lpfnWndProc   = Default;
 wc.cbClsExtra    = 0;
 wc.cbWndExtra    = 0;
 wc.hInstance     = progInstance;
 wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
 wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
 wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+15);
 wc.lpszMenuName  = NULL;
 wc.lpszClassName = "WindowClass";
 wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

 if (!RegisterClassEx (&wc))
 {
  return -1;
 }
 defaultWnd = CreateWindow (
              "WindowClass",
              "HELLO",
              WS_DISABLED,
              1, 
              1,
              1,
              1,
              NULL,
              NULL,
              progInstance,
              NULL);
 return 0;
}

class WINDOW
{
 private:
  
  HWND *controls;
  HWND winCreated;
  int index, count;
  bool firstControl;
  friend int DestroyWndVar ();

 public:

  int MakeWindow (const char *WinTitle, int xPos, int yPos, int xSize, int ySize, WNDPROC wndproc)
  {
   if (SetClassLong (defaultWnd, GCL_WNDPROC, (LONG) wndproc) == 0)
    return -1;
   
   winCreated = CreateWindow (
                "WindowClass",
	            WinTitle,
	            WS_OVERLAPPEDWINDOW,
	            xPos,
	            yPos,
	            xSize,
	            ySize,
	            NULL,
	            NULL,
	            instance,
	            NULL);
   index = 0;
   count = 1;
   controls = (HWND *) malloc (1);
   firstControl = true;

   return 0;
  }
  int  AddButton (const char *ButtonText, int xPos, int yPos, int xSize, int ySize)
  {
   HWND button;
   HWND *temp;

   button = CreateWindow (
            "BUTTON",
	        ButtonText,
	        WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
	        xPos,
	        yPos,
	        xSize,
	        ySize,
	        winCreated,
            (HMENU) index,
	        instance,
	        NULL);

   controls[index] = button;
   ++index;
   ++count;
   temp = (HWND *) realloc (controls, count * sizeof (HWND));
   if (temp == NULL)
   {
    return -1;
   }
   controls = temp;
   return 0;
  }
  int  AddTextBox     (const char *starttext, int xPos, int yPos, int xSize, int ySize)
  {
   HWND textbox;
   HWND *temp;

   textbox = CreateWindow (
            "EDIT",
	        starttext,
	        WS_CHILD | WS_VISIBLE | WS_BORDER |ES_AUTOHSCROLL | WS_GROUP | WS_TABSTOP,
	        xPos,
	        yPos,
	        xSize,
	        ySize,
	        winCreated,
            (HMENU) index,
	        instance,
	        NULL);

   controls[index] = textbox;
   ++index;
   ++count;
   temp = (HWND *) realloc (controls, count * sizeof (HWND));
   if (temp == NULL)
   {
    return -1;
   }
   controls = temp;
   return 0;
  }
  int  AddComboBox    (const char *data[], int arrayItems, int xPos, int yPos, int xSize, int ySize)
  {
   HWND combobox;
   HWND *temp;

   combobox = CreateWindow (
            "COMBOBOX",
	        "",
	        WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_HASSTRINGS | CBS_DROPDOWNLIST | WS_TABSTOP,
	        xPos,
	        yPos,
	        xSize,
	        ySize,
	        winCreated,
            (HMENU) index,
	        instance,
	        NULL);

   for (int added = 0; added < arrayItems; added++)
   {
    SendMessage (combobox, CB_ADDSTRING, 0, (LPARAM) data[added]);
   }

   controls[index] = combobox;
   ++index;
   ++count;
   temp = (HWND *) realloc (controls, count * sizeof (HWND));
   if (temp == NULL)
   {
    return -1;
   }
   controls = temp;
   return 0;
  }
  int  AddStaticText  (const char *text, int xPos, int yPos, int xSize, int ySize)
  {
   HWND statictext;
   HWND *temp;

   statictext = CreateWindow (
            "STATIC",
	        text,
	        WS_CHILD | WS_VISIBLE,
	        xPos,
	        yPos,
	        xSize,
	        ySize,
	        winCreated,
            (HMENU) index,
	        instance,
	        NULL);

   controls[index] = statictext;
   ++index;
   ++count;
   temp = (HWND *) realloc (controls, count * sizeof (HWND));
   if (temp == NULL)
   {
    return -1;
   }
   controls = temp;
   return 0;
  }
  void Visible (int show)
  {
   ShowWindow (winCreated, show);
   UpdateWindow (winCreated);
  }
  HWND GetHandle (void)
  {
   return winCreated;
  }
};

#endif
i know that it isnt very heavily error checked, but if anyone can help me with this, i would be very very greatful. I have no clue where to even start!