Page 1 of 1
Using MailSlots to communicate between apps.
Posted: Sat Jun 09, 2007 6:38 pm
by Flype
sorry if it has already be done,
i'm testing mailslots to send/receive datas from an app to another.
here is little archive if you want to test (free to use) :
MailSlot.zip
More infos here on MSDN :
http://msdn2.microsoft.com/en-us/library/aa365147.aspx
Posted: Sat Jun 09, 2007 8:55 pm
by Flype
updated.
Declare.l MailSlot_WriteString(hSlot.l, string.s) ; Writes a string to the given mailslot.
Declare.l MailSlot_WriteData(hSlot.l, *MemoryBuffer, LengthToWrite.l) ; Writes the content of the specified memory buffer to the given mailslot.
Declare.s MailSlot_ReadString(hSlot.l) ; Reads a string from the given mailslot.
Declare.l MailSlot_ReadData(hSlot.l, *MemoryBuffer, LengthToRead.l) ; Reads the content from the given mailslot inside the specified memory buffer.
Declare.l MailSlot_Open(SlotName.s) ; Open an existing mailslot, must be closed using CloseSlot().
Declare.l MailSlot_Next(hSlot.l) ; Returns #True if there are one or more messages in the given mailslot.
Declare.s MailSlot_LastError() ; Returns a formatted string of the last error.
Declare.l MailSlot_Create(SlotName.s) ; Creates a mailslot, must be closed using CloseSlot().
Declare.l MailSlot_Close(hSlot.l) ; Close an existing mailslot.
Posted: Mon Jun 11, 2007 4:23 pm
by Chrono Syndrome
Good job.
Posted: Mon Jun 11, 2007 4:52 pm
by Inf0Byt3
This is pretty usefull. Thanks Flype!
Posted: Mon Jun 11, 2007 6:12 pm
by blueznl
Seems to be a hot topic lately
Mailslots work well, they're just limited to 400+ bytes I believe, but that should be enough for many cases.
Gonna have a look at it myself later

Posted: Mon Jun 11, 2007 11:33 pm
by blueznl
Doing a search on the boards indeed showed a few cases, but that isn't going to stop us, is it?
http://www.purebasic.fr/english/viewtop ... 997#198997
Posted: Tue Jun 12, 2007 12:36 am
by Flype
nice example, you learn fast

Posted: Tue Jun 12, 2007 3:34 pm
by blueznl
Actually, I did not even use your sample, I admit I had a look at it, but as I'm not into libraries I decided to figure it out on my own the best way I could, by bumbling and stumbling around
I didn't test yet the 'multiple mailslot' thing, can multiple programs have the same mailslot open? Documentation was a bit conclicting on that one. Did you look into that?