From linux smbclient -M servername should return a connection, at which point you'll want to type your message, then send it with ctrl + d. You end the session with ctrl + c.
For windows you'll want to use net send.
http://www.lantalk.net/net-send-command.php
You'll want to look into linpopup to recieve messages.
http://www.littleigloo.org/software_002.php3
Hope that's enough to get you going.
good luck.