Click here to Skip to main content
15,916,463 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: virtual inheritance and polymorphism! Pin
Resmi Anna1-Aug-11 23:04
Resmi Anna1-Aug-11 23:04 
GeneralRe: virtual inheritance and polymorphism! Pin
Emilio Garavaglia2-Aug-11 20:30
Emilio Garavaglia2-Aug-11 20:30 
GeneralRe: virtual inheritance and polymorphism! Pin
Dean Seo3-Aug-11 16:24
Dean Seo3-Aug-11 16:24 
QuestionHow to disable a checkbox created using MFCRibbonCheckBox? Pin
MeghaJoshi1-Aug-11 18:22
MeghaJoshi1-Aug-11 18:22 
AnswerRe: How to disable a checkbox created using MFCRibbonCheckBox? Pin
Dr.Walt Fair, PE1-Aug-11 18:51
professionalDr.Walt Fair, PE1-Aug-11 18:51 
AnswerRe: How to disable a checkbox created using MFCRibbonCheckBox? Pin
Code-o-mat2-Aug-11 3:07
Code-o-mat2-Aug-11 3:07 
QuestionValue of an object in visual studio Pin
AndrewG12311-Aug-11 13:34
AndrewG12311-Aug-11 13:34 
AnswerRe: Value of an object in visual studio Pin
Richard Andrew x641-Aug-11 13:48
professionalRichard Andrew x641-Aug-11 13:48 
QuestionCreateNamedPipe() Pin
Member 38520241-Aug-11 12:36
Member 38520241-Aug-11 12:36 
AnswerRe: CreateNamedPipe() Pin
Richard Andrew x641-Aug-11 12:45
professionalRichard Andrew x641-Aug-11 12:45 
GeneralRe: CreateNamedPipe() Pin
Member 38520241-Aug-11 12:54
Member 38520241-Aug-11 12:54 
GeneralRe: CreateNamedPipe() Pin
Richard Andrew x641-Aug-11 12:59
professionalRichard Andrew x641-Aug-11 12:59 
GeneralRe: CreateNamedPipe() Pin
Member 38520241-Aug-11 12:59
Member 38520241-Aug-11 12:59 
GeneralRe: CreateNamedPipe() Pin
Richard Andrew x641-Aug-11 13:05
professionalRichard Andrew x641-Aug-11 13:05 
GeneralRe: CreateNamedPipe() Pin
Member 38520241-Aug-11 13:16
Member 38520241-Aug-11 13:16 
GeneralRe: CreateNamedPipe() Pin
Richard Andrew x641-Aug-11 13:23
professionalRichard Andrew x641-Aug-11 13:23 
GeneralRe: CreateNamedPipe() Pin
Member 38520241-Aug-11 13:30
Member 38520241-Aug-11 13:30 
GeneralRe: CreateNamedPipe() Pin
Richard Andrew x641-Aug-11 13:32
professionalRichard Andrew x641-Aug-11 13:32 
GeneralRe: CreateNamedPipe() Pin
Member 38520241-Aug-11 23:27
Member 38520241-Aug-11 23:27 
GeneralRe: CreateNamedPipe() Pin
Richard Andrew x641-Aug-11 13:34
professionalRichard Andrew x641-Aug-11 13:34 
GeneralRe: CreateNamedPipe() Pin
Member 38520242-Aug-11 3:16
Member 38520242-Aug-11 3:16 
AnswerRe: CreateNamedPipe() Pin
Richard Andrew x641-Aug-11 13:14
professionalRichard Andrew x641-Aug-11 13:14 
GeneralRe: CreateNamedPipe() Pin
Member 38520241-Aug-11 13:17
Member 38520241-Aug-11 13:17 
GeneralRe: CreateNamedPipe() Pin
Member 38520241-Aug-11 23:03
Member 38520241-Aug-11 23:03 
AnswerRe: CreateNamedPipe() Pin
Chuck O'Toole2-Aug-11 15:38
Chuck O'Toole2-Aug-11 15:38 
I have read the entire thread so far and I think I see the problem here. The "Server" side of named pipes needs some magic in order to support multiple clients accessing it, even if those clients are "synchronized".

A named pipe is still a "one shot deal", that is, you create it, wait for a connection, accept the connection, and then close the pipe when you are all done. That means that a single "client" can access the pipe. In order for multiple clients to work, you have to have multiple instances of the "named pipe", in other words, you have lots of pipes with the same name all ready for use.

The easiest way to do this is demonstrated in the following pseudo-code (I cannot actually paste my working code as it belongs to my employer, as does my soul and first born
HANDLE P1 = create_a_named_pipe("Bob");

While (TRUE)
{
  HANDLE P2 = create_a_named_pipe("Bob"); // A "pipe in waiting"

  wait_for_a_connection(P1);
  
  // at this point, you can process the messages being passed on P1.  You can either do it in
  // this code or if you are communicating with "unsynchronized" clients, you might want to
  // create a thread to work on P1.  If you do that, make sure then make their own copy of
  // P1 because we are about to clobber it.

  // once you are done processing the communication, close the P1 handle, here or in the thread

  P1 = P2;  // switch to the waiting pipe
}
).
Anyway, you need to maintain at least one "unattached" pipe with the proper name so that clients have something to "connect to" while you are busy working with the other client or cleaning up after you are done with it.

Managing how one and only one application will have a pipe named "Bob" is an exercise for the student Smile | :)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.