How does this work?

Tres
09-27-2004, 03:09 AM
Does anyone know why this works to send net send messages?


Function SendMsg(From1 As String, To2 As String, Text3 As String) As Long
'this is all to send a message, unless ur an expert, leave it that way :)
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 = "\\" + To2 + "\mailslot\messngr"
msgtxt = From1 + Chr(0) + To2 + Chr(0) + Text3 + Chr(0)
mshandle = CreateFile(mailslotname, GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, -1)
rc = WriteFile(mshandle, msgtxt, Len(msgtxt), byteswritten, 0)
rc = CloseHandle(mshandle)
End Function



Im just curious.

Jonny
09-27-2004, 06:19 AM
there is nothing in that code that sends netsend messages.
it opens a file, writes to it, then closes it.

koncept
09-27-2004, 10:32 AM
yes, i use this code quite a bit. it uses mailslots to send the net send meesage. it has some nice featurea as it allows you to change who it appears to be from. if you need more help with it lemme know.

Tres
09-27-2004, 03:52 PM
How do mailslots work? are they just like hoiw net send works?

also is it possible to send to a username instead of the computer name and still be able to set who its from?

Thanks.

koncept
09-27-2004, 04:00 PM
they work just like net sends except they can be recieved and sent from win 98 (possibly 95) You need another program to read the slots on 98. im not sure what you mean by user name. If you mean can i send it to "user32 of my computer" and "user 37 of your computer" rather than "my computer" and "your computer" i dont know. it goes to what ever user is logged in at the time as far as i know

Tres
09-27-2004, 08:36 PM
Thanks :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum