>*======================================================== >* Send a message to a computer. Same as NET SEND. >*======================================================== >PROCEDURE SendMsg >LParameter tcTarget, tcSender, tcReceipient, tcMessage > > *------------------------------------------------------ > * Open the mailslot that is used by NET SEND > *------------------------------------------------------ > #DEFINE GENERIC_WRITE 0x40000000 > #DEFINE FILE_SHARE_READ 0x00000001 > #DEFINE OPEN_EXISTING 3 > #DEFINE FILE_ATTRIBUTE_NORMAL 0x00000080 > #DEFINE INVALID_HANDLE_VALUE -1 > Local lnHandle, llOK > Declare Long CreateFile in Win32API ; > String, Long, Long, Long, Long, Long, Long > lnHandle = CreateFile( ; > "\\"+m.tcTarget+"\mailslot\messngr", ; > GENERIC_WRITE, ; > FILE_SHARE_READ, ; > 0, ; > OPEN_EXISTING, ; > FILE_ATTRIBUTE_NORMAL, ; > 0 ; > ) > llOK = (m.lnHandle#INVALID_HANDLE_VALUE) > > *------------------------------------------------------ > * Write the message into the mailslot. > *------------------------------------------------------ > Local lcMessage, lnBytes > If m.llOK > lcMessage = m.tcSender + Chr(0) + m.tcReceipient + ; > Chr(0) + m.tcMessage + Chr(0) > Declare Long WriteFile in Win32API ; > Long, String, Long, Long@, Long > lnBytesWritten = 0 > llOK = WriteFile( m.lnHandle, ; > m.lcMessage, ; > Len(m.lcMessage), ; > @lnBytes, ; > 0 ; > ) # 0 > Endif > > *------------------------------------------------------ > * Close mailslot > *------------------------------------------------------ > If m.lnHandle # INVALID_HANDLE_VALUE > Declare CloseHandle in Win32API Long > CloseHandle( m.lnHandle ) > Endif > >Return m.llOK >>Call the program like this:
>SendMsg("computername","your name","recipient's name","the message") >>