network messages

How do you send a message from one computer to another on a network?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

AleckConnect With a Mentor Commented:
'the source code is work under windows 95 and 98 but you can't recive a 'message, but the windows API that recives messages is the 'MAILSLOT

Option Explicit

'Windows API/Global Declarations for :Send message to winpopup

Global Const OPEN_EXISTING = 3
Global Const GENERIC_READ = &H80000000
Global Const GENERIC_WRITE = &H40000000
Global Const GENERIC_EXECUTE = &H20000000
Global Const GENERIC_ALL = &H10000000
Global Const FILE_SHARE_READ = &H1
Global Const FILE_SHARE_WRITE = &H2

Declare Function CloseHandle Lib "kernel32" (ByVal hHandle As Long) As Long

Declare Function WriteFile Lib "kernel32" (ByVal hFileName As Long, ByVal lpBuff As Any, ByVal nNrBytesToWrite As Long, lpNrOfBytesWritten As Long, ByVal lpOverlapped As Long) As Long

Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwAccess As Long, ByVal dwShare As Long, ByVal lpSecurityAttrib As Long, ByVal dwCreationDisp As Long, ByVal dwAttributes As Long, ByVal hTemplateFile As Long) As Long
' Name: Send message to winpopup
'     ' Description:Send message to WinPopUp from your programs.

' Inputs:None
' Returns:None
' Assumes:None
' Side Effects:None
'Code provided by Planet Source Code(tm) 'as is', without
'     warranties as to performance, fitness, merchantability,
'     and any other warranty (whether expressed or implied).

Function SendToWinPopUp(PopFrom As String, PopTo As String, MsgText As String) As Long

        Dim rc As Long
        Dim mshandle As Long
        Dim msgtxt As String
        Dim byteswritten As Long
        Dim mailslotname As String
       '      ' name of the mailslot
        mailslotname = "\\" + PopTo + "\mailslot\messngr"
        msgtxt = PopFrom + Chr(0) + PopTo + Chr(0) + MsgText + Chr(0)
        mshandle = CreateFile(mailslotname, GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
        rc = WriteFile(mshandle, msgtxt, Len(msgtxt), byteswritten, 0)
        rc = CloseHandle(mshandle)
End Function

There are many ways you can communicate from one system to another.
1. TCP/IP using Winsock control
2. Serial Communication using MS Comm Control
3. Sharing a File on One system and writing to it.
4. Using DCOM
5. Using Remote automation
6. Using Mail Slots
7. Using MSMQ
8. Using Pipes
9. Using Mail
It all depoends on your choice, select the one depending on advantages and disadvantages offered by each of the machanisms and your project requirements.
All Courses

From novice to tech pro — start learning today.