BOOL DisconnectNamedPipe(HANDLE Handle);
Le résultat est Vrai si l'opération est autorisée.
#include <windows.h>
#include <winbase.h>
HANDLE Handle;
OVERLAPPED Informations;
Handle=CreateNamedPipe("MonTuyau", PIPE_ACCESS_DUPLEX|FILE_FLAG_WRITE_THROUGH, PIPE_TYPE_BYTE|PIPE_READMODE_BYTE|PIPE_NOWAIT,PIPE_UNLIMITED_INSTANCES, 1024, 1024, 10000, NULL);
if (Handle==INVALID_HANDLE_VALUE)
{
...
}
...
Informations.Internal=0;
Informations.InternalHigh=0;
Informations.Offset=0;
Informations.OffsetHigh=0;
Informations.hEvent=0;
if (!ConnectNamedPipe(TuyauNomme, &Informations))
{
...
}
...
if (DisconnectNamedPipe(Handle))
{
...
}
...
CloseHandle(Handle);