This article is about a CSocket-based chat server/client, which is something that's been very well discussed. Here the display is in HTML format so the user can change the look of the messages he sends. It also has features such as alerting on message arrival and putting the program icon in the system tray when hidden, which is very useful.
For putting it in the system tray, we have to use the Shell_NotifyIcon() function.
NOTIFYICONDATA not; not.cbSize =sizeof(NOTIFYICONDATA); not.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME); not.hWnd =this->m_hWnd ; strcpy(not.szTip ,"iChat Standard"); not.uCallbackMessage=ID_TRAY; not.uFlags =NIF_ICON|NIF_MESSAGE|NIF_TIP; not.uID =1; Shell_NotifyIcon(NIM_ADD ,¬);
We will receive tray icon messages on id ID_TRAY. It makes sure that only one instance of the chat server runs at any time. Finally, this chat program is integrated with Microsoft NetMeeting for ease of use.
DownloadsDownload demo project - 204 Kb
Download source - 359 Kb