Solved

Check if named pipe exists

Posted on 2010-08-30
2
3,152 Views
Last Modified: 2013-12-04
Hi,

How to check if named pipe exists? (CreateNamedPipe is not called)?
0
Comment
Question by:lavitz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 500 total points
ID: 33561736
The file  exists or not.
Check if that's what you need:
MSDN. http://msdn.microsoft.com/en-us/library/aa365592(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa365592(VS.85).aspx

There is a sample with a loop waiting for a named pipe:
LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe");
HANDLE hPipe;

while (1)
{
   hPipe = CreateFile( lpszPipename,  GENERIC_READ | GENERIC_WRITE,  0,  
         NULL, OPEN_EXISTING,   0, NULL);          
    if (hPipe != INVALID_HANDLE_VALUE)
         break;
 
    if (GetLastError() != ERROR_PIPE_BUSY)
    {
         _tprintf( TEXT("Could not open pipe. GLE=%d\n"), GetLastError() );
         return -1;
    }

   // wait, etc.
}
0
 

Author Closing Comment

by:lavitz
ID: 33575869
Ok, if there is no other way
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question