Hi, welcome to the boards. For future reference a question about windows api function can elict more responses on the windows board.
In the processes you create(output processes) you need to:
- Create a mailslot.
- Listen on that mailslot.
- Write to output when told to.
In the master process you need to:
- Create the output processes.
- Connect to their mailslots.
- Write to their mailslots to tell them to continue.
Sample for output process:
Sample for master process:
HANDLE hSlot = CreateMailslot("\\\\.\\mailslot\\msname", 0, MAILSLOT_WAIT_FOREVER, NULL);
ReadFile(hSlot, buf, sizeof(buf), &dwRead, NULL); // Receive message from master.
printf("%s", buf); // print what the master has told us to.
Things to think about:
// Create Processes
// Connect to mailslots.
hSlot1 = CreateFile("\\\\.\\mailslot\\msname", ...);
// Write to mailslots what you want them to output.
WriteFile(hSlot1, "test", 4, ...);
- You need a different name for each mailslot (maybe pass the name you want the output process to use on the command line).
- You need to make sure that the master process does not try to connect to a mailslot before it is created.