MsgWaitForSingleObject and named pipe. Which event am I getting ?

"R.Wieser" <[email protected]> Tue, 17 Mar 2026 10:06:51 +0100
Newsgroups comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general
Organization A noiseless patient Spider
Message-ID <[email protected]>
Hello all,

I would like to write some single-threaded code to work with a single 
non-blocking, non-overlapped (incoming) named pipe, in combination with 
MsgWaitForSingleObject - the latter as part of the message-loop.

The problem is that although it looks like I can wait /something/ to happen 
with the pipe, I do not see how I can get *what* is happening : A new 
connection (ConnectNamedPipe), or data coming in (ReadFile).

Does anyone have an idea ?   Some example code perhaps ?

Regards,
Rudy Wieser

p.s.
I was thinking of using a flag indicating the current mode, but that would 
not work well if I ever decide to accept more than a single connection. :-|