Named pipe its practical or API functions, I think the bottom line should be the operating system allocated a separate memory space, two programs or more than one program can read and write this memory.
These so-called pipeline API functions are the way our programmers manipulate these memory spaces.
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
API functions Used
When the pipeline server first calls the CreateNamedPipe () function, the nmaxinstance parameter is used to specify the maximum number of pipeline instances that can exist concurrently. The server can repeatedly call the CreateNamedPipe () function to create a new instance of the pipeline until it reaches the maximum number of instances set. The following is a function prototype for CreateNamedPipe ():
HANDLE createnamedpipe ( lpctstr lpname,//Pointer to pipe name DWORD Dwopenmode,//Pipe open mode DWORD Dwpipemode,//Piping mode C3/>dword nmaxinstances,//MAX instance number DWORD noutbuffersize,//output cache size DWORD ninbuffersize,//input cache size DWORD Ndefaulttimeout,//timeout setting lpsecurity_attributes lpsecurityattributes//security attribute pointer );
The purpose has been realized, see Xinxin Sun's book in detail VC + + in layman's
First step: Create a solution
Step Two: Add two dialog box programs
Step three: Add the List Edit button control, modify the ID and caption, and adjust the respective positions.
Fourth step: Complete the code of a
Fifth step: Complete the Code of B
Sixth step: Adjust the code of the Create pipeline for a
Seventh step: Compile debug Run result OK
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PostScript: The above function is only the feasibility of testing the pipeline function, in order to achieve stable and reliable communication.
The following improvements need to be made:
1) Create a worker thread, constantly listen to the data pipeline inside, if any, immediately processing, otherwise the time is long the cache will be full
2)
Xxxxxxxxxxxxxxxx
The source code is as follows: Link: Http://pan.baidu.com/s/1gdrpzeN Password: 7in5
Named Pipes for interprocess communication