This project should be useful as a utility and also as a source of sample code for using Mailslots in VB6 programs. The Mailslot.ctl in this Project should prove usuable for most simple applications of Mailslots in VB6. Just copy Mailslot.ctl and Mailslot.ctx to your Project folder and then use Add file... to add the control.
The precompiled binary files were scanned with AVG Free 8.5 and should prove virus-free.
CafChat 1.1 is a basic P2P LAN chat applet. It allows users at multiple different machines within the same Domain or Workgroup to chat with each other.
If left running or if a shortcut is placed in the Start Menu's Startup folder, CafChat can be used as a simple alternative to the Messenger Service and NET SEND commands. Windows Vista and later do not include those tools. Unlike using MSG.EXE which is not part of Vista Home editions CafChat does not require that Terminal Services/Remote Desktop be installed and running.
Because of the way it uses Mailslots only one copy can be run on each machine. This makes it unsuitable for Terminal Servers. Aside from basic testing two machines or a second machine in a VM are required. The machines must have Windows Networking (File and Print Sharing) enabled, and the firewalls must allow it through. Verifying this is important since it is the most likely source of failure.
Simple short-message chatting among multiple parties.
Send on "enter" (no need to click the Send button).
List of active users, showing username@computername.
Regular message Send plus Alert send. Alert will flash the taskbar button of minimized peers.
Lightweight (61K plus 212K richtx32.ocx).
Enclosed precompiled binary uses registration-free COM, which allows it to be stored on removable media and run without installation on Windows XP or later. Tested on XP SP3, Vista SP2, and Windows 7 RC.
For best results the VB6 SP6 runtime is recommended. Deploying the precompiled binary to XP or later is simple. Just copy the "bin" folder contents to a hard drive or flash drive location. If installing on a hard drive you may wish to create a shortcut on your desktop, which can be dragged or copied to your Start Menu as well.
It should be possible to recompile and package CafChat for formal installation on Windows 9x, 2000, and later.
Unencumbered public domain freeware. May be used by anyone in whole or in part in either source or binary forms. No guarantees or support offered. CafChat is made available as-is for use at your own discretion.
No, there is nothing special about the Send button being the default control and letting you use Enter to Send. Amazing how many people will "type type, grab mouse and click default button" though if you don't state this.
There is zero configuration required. As long as the machines are in the same "space" (Workgroup or Domain) and the firewalls are open to File and Printer Sharing it should just work. It does not use any dedicated TCP or UDP ports besides those already in use by Windows Networking.
No, it does not work across the Internet unless you are using a VPN or something to extend your LAN across it. The broadcasts it uses will not normally traverse in-house routers either. You will likely find it confined to the LAN segment (as joined via hubs and switches).
Here is a rewrite that incorporates numerous suggestions to simplify the program for use by end users:
User names have been simplified by dropping the suffix @computername due to numerous requests.
Sending in "alert" mode has been dropped because users had no practical use for it and found alert messages annoying.
Mailslot machine to machine limits and message truncation are handled in a more reliable manner. On sending a long message that gets truncated the sending user is now warned.
In some network environments Mailslot messages arrive duplicated. Duplicates are detected and silently dropped now.
A timestamp prefix has been added to displayed messages.
A splitter bar is now available, allowing the Users list to be resized.
Where practical, CafChat 2.0 will interoperate with existing CafChat 1.x peers.
In this Zip archive there is a subfolder named CafChat that contain a precompiled, XCopy-deployable program. This is the same as the "bin" folder in the previous version, which seemed to confuse people.
Just copy this CafChat folder to your hard drive or USB flash drive and run it from there.
Remember, since you have the full source you can restore earlier features or add new ones. If you are not a VB6 programmer and don't have the necessary tools and compiler license yourself there are many VB6 programmers who can make custom changes at quite reasonable costs.
Last edited by dilettante; Aug 4th, 2010 at 04:44 PM.
Reason: Small change in the program
Before anyone asks, splitter bars are used to adjust multiple "panels" within windows. You click and hold on them and then you can drag them to resize the regions that they split. So here we can change the width of the Users list relative to the chat log area.
I need Help!
When I'm running the project,
I'm getting a error message as
"Run-time error '-21471470448(8004c770) WriteFile failed, error64"
when I press the "Debug" button,
the yellow highlighted text as
"Err.Raise &H8004C770, "Mailslot.SendMsg", _
"WriteFile failed, error " & CStr(Err.LastDllError)"
Hung copies means?????
I can't able to find any copies of VB6.0 in task manager..........
I was referring to copies of the CafChat EXE that might have become "stuck" running with no visible user inteface.
I am beginning to think you are not running CafChat, but are instead playing with the CafChat project opened in the VB6 IDE. If this is true you should be aware that a program crash, End statement, Ctrl-Break, etc. may leave an open mailslot handle which persists until you terminate the VB6 IDE itself.
Each run after you stop a test in the IDE wil fail with the error until you terminate the IDE and run it all over again.
You can also get this error if you are using Fast User Switching to log on as a second user when the first user is already running CafChat. There cannot be two copies of CafChat running on the same PC.
No idea what you are unhappy about. Perhaps the "only one instance of the program per PC" limitation?
If so, you'll face much the same issue with anything else you use. The idea here is peer-to-peer communication using broadcast messages. Broadcasts have many of the same issues whether you use mailslots or UDP.
An alternative might be a server-based approach with clients connecting to the server. That's a pretty well-worn, fairly boring thing to do though, and you should find tons of examples. It also has the problem that at least one machine must run the server and the client programs need to know which machine that is.
If your struggles come from crashing or stopping the program in the VB6 IDE you can try taking care to close the mailslot handle using the Immediate window of the IDE. Using the Winsock control with the UDP protocol gets around that since it will clean up after itself.
One downside of using UDP is that you have to find an unused port number that you can "steal" for use. Another is that arbitrary UDP broadcasts are not relayed between LAN segments in managed networks, unlike mailslots.
But that's common enough as well, and you should find tons of examples of UDP broadcast peer chat programs if you can't figure out how to do it. The VB6 manual covers Winsock control UDP pretty well.