Client: Chat Client Sample

Click to open or copy the files for the Client sample.

The GlobChat client includes the following source files and functions.

About.c

Displays the About dialog box.

Function Description
CmdAbout Displays the About dialog box
About Processes messages for the About dialog box
MsgAboutInit Initializes the About dialog box with version information from resources
MsgAboutCommand Processes the WM_COMMAND message sent to the About box
CmdAboutDone Frees the About box and related data

Connect.c

Displays the Connect dialog box.

Function Description
CmdConnect Displays the Connect dialog box
Connect Processes messages for the Connect dialog box
MsgConnectInit Initializes edit controls
MsgConnectReadyForWrite Sends name registration message when connection established with server
MsgConnectCommand Process a WM_COMMAND message sent to the Connect box
CmdConnectDone Frees the Connect box and related data
CmdConnectNow Establishes connection to server
CmdConnectEnableOK Enables or disables OK button when input data is valid or invalid

Dispatch.c

Implements the generic message and command dispatchers.

Function Description
DispMessage Calls the function associated with a message
DispCommand Calls the function associated with a command
DispDefault Calls the appropriate default window procedure

Globcl.c

Implements the windows procedure for the main application windows. Also implements the generic message and command dispatchers.

Function Description
WndProc Processes messages for the main window
MsgCreate Initializes Edit Controls for text input/output
MsgSize Adjusts size of Edit Controls when window is resized
MsgSetfocus Keeps window focus on edit control instead of parent
MsgDataready Reads data from incoming IPC mechanism
MsgRefreshdisplay Refills Inbox edit control text contents
MsgDisconnected Cleans up connection killed by other side
MsgCommand Handles the WM_COMMAND messages for the main window
MsgDestroy Handles the WM_DESTROY message by calling PostQuitMessage
CmdOutbox Handles messages from Outbox edit control
CmdDisconnected Disconnects current connection
CmdEndChat Ends Peer to Peer session
CmdExit Handles the file exit command by calling DestroyWindow on the main window

Init.c

Performs application and instance specific initialization.

Function Description
InitApplication Initializes window data and registers window

Misc.c

Contains all helper functions "global" to the application.

Function Description
CenterWindow Centers one window over another
ReceiveInBox Reads incoming socket data
SendOutBox Writes outgoing socket data
AtoH Converts ascii string to network order hex
BtoH Converts ascii byte to hex
senddatamessage Sends a message to the server
recvdatamessage Receives a message from the server

Select.c

Displays the Select dialog box.

Function Description
CmdSelect Displays the Select dialog box
Select Processes messages for the Select dialog box
MsgSelectInit Sets up event message notification for socket
MsgSelectDataReady Processes socket event message notifications
MsgSelectCommand Processes WM_COMMAND message sent to the Select box
CmdSelectDone Frees the select box and related data
CmdSelectOK Requests Peer session
CmdSelectList Enables/disables OK button

Winmain.c

Calls initialization functions and processes the message loop.

Function Description
WinMain Calls initialization functions, processes message loop

Building SDK Samples

This sample uses the following keywords:

atoh; btoh; centerwindow; cleanup; closesocket; cmdabout; cmdaboutdone; cmdconnect; cmdconnectdone; cmdconnectenableok; cmdconnectnow; cmddisconnect; cmdendchat; cmdexit; cmdoutbox; cmdselect; cmdselectdone; cmdselectlist; cmdselectok; connect; createfont; createwindow; defdlgproc; defframeproc; defmdichildproc; defwindowproc; deleteobject; destroywindow; dialogbox; dispatchmessage; dispcommand; dispdefault; dispmessage; enablemenuitem; enablewindow; enddialog; enumprotocols; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getaddressbyname; getaddrstring; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getmenu; getmessage; getmodulefilename; getparent; getstringres; getwindow; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; htoa; htob; initapplication; loadaccelerators; loadcursor; loadstring; lstrcat; lstrcpy; lstrlen; makelong; makelparam; makeword; messagebox; movewindow; msgaboutcommand; msgaboutinit; msgcommand; msgconnectcommand; msgconnectinit; msgconnectreadyforwrite; msgcreate; msgdataready; msgdestroy; msgdisconnected; msgrefreshdisplay; msgselectcommand; msgselectdataready; msgselectinit; msgsetfocus; msgsize; muldiv; peekmessage; pfncmd; pfnmsg; postmessage; postquitmessage; reallen; receiveinbox; recv; recvdatamessage; registerclass; releasedc; select; send; senddatamessage; senddlgitemmessage; sendmessage; sendoutbox; set_netbios_sockaddr; setdlgitemtext; setfocus; setwindowpos; setwindowtext; showwindow; socket; svcid_netware; svcid_tcp; switch; translateaccelerator; translatemessage; updatewindow; verqueryvalue; virtualalloc; winmain; wndproc; wsaasyncselect; wsacleanup; wsagetlasterror; wsastartup; wsprintf