network messages

How do you send a message from one computer to another on a network?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

'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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.