|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| No
| Import Library
| kernel32.lib
| Header File
| winbase.h
| Unicode
| No
| Platform Notes
| None
|
|
|
CreatePipe
The CreatePipe function creates an anonymous pipe, and returns handles to the read and write
ends of the pipe.
BOOL CreatePipe(
PHANDLE hReadPipe,
| // address of variable for read handle
| PHANDLE hWritePipe,
| // address of variable for write handle
| LPSECURITY_ATTRIBUTES lpPipeAttributes,
| // pointer to security attributes
| DWORD nSize
| // number of bytes reserved for pipe
| );
|
|
Parameters
hReadPipe
Points to the variable that receives the read handle for the pipe.
hWritePipe
Points to the variable that receives the write handle for the pipe.
lpPipeAttributes
Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by
child processes. If lpPipeAttributes is NULL, the handle cannot be inherited.
Windows NT: The lpSecurityDescriptor member of the structure specifies a security descriptor for the new pipe. If lpPipeAttributes is NULL, the pipe gets a default security descriptor.
Windows 95: The lpSecurityDescriptor member of the structure is ignored.
nSize
Specifies the buffer size for the pipe. The size is only a suggestion; the
system uses the value to calculate an appropriate buffering mechanism. If this
parameter is zero, the system uses the default buffer size.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error
information, call GetLastError.
Remarks
CreatePipe creates the pipe, assigning the specified pipe size to the storage buffer. CreatePipe also creates handles that the process uses to read from and write to the
buffer in subsequent calls to the ReadFile and WriteFile functions.
To read from the pipe, a process uses the read handle in a call to the ReadFile function. ReadFile returns when one of the following is true: a write operation completes on the
write end of the pipe, the number of bytes requested has been read, or an
error occurs.
When a process uses WriteFile to write to an anonymous pipe, the write operation is not completed until all
bytes are written. If the pipe buffer is full before all bytes are written, WriteFile does not return until another process or thread uses ReadFile to make more buffer space available.
See Also
ReadFile, SECURITY_ATTRIBUTES, WriteFile
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|