🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #519

Re: Detecting virtual comports

#519
From: Remy Lebeau (TeamB)
Date: Fri, 25 Jan 2008 20:54
21 lines
1762 bytes
"Giuliano" <nonfracassatelepalline@non_fracassate_le_pall.ine> wrote in 
message news:vegkp3hhb89k52eol1c49492gc46k3iedv@4ax.com...

>        if ( dwError == 5 )  // Port exists, but cannot be opened
>            InUse = true;
>        else if ( dwError == 2 )  // Port does not exist
>            return false;

Rather than checking for numeric literals, you should use the predefined 
constants in winerror.h instead, so you can see what the code is actually 
checking for, ie:

    if ( dwError == ERROR_ACCESS_DENIED )  // Port exists, but cannot be 
opened
        InUse = true;
    else if ( dwError == ERROR_FILE_NOT_FOUND )  // Port does not exist
        return false;


Gambit
Technical Details
Message-ID: <479a4c61$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4799cc68$1@newsgroups.borland.com> <njkjp3d5feaailo8p568elmqhntg8br1ku@4ax.com> <4799e374$1@newsgroups.borland.com> <vegkp3hhb89k52eol1c49492gc46k3iedv@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1645444b8ff69f0e
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4799cc68$1@newsgroups.borland.com> <njkjp3d5feaailo8p568elmqhntg8br1ku@4ax.com> <4799e374$1@newsgroups.borland.com> <vegkp3hhb89k52eol1c49492gc46k3iedv@4ax.com>
Subject: Re: Detecting virtual comports
Date: Fri, 25 Jan 2008 12:54:41 -0800
Lines: 23
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 207.178.157.90
Message-ID: <479a4c61$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1201294433 207.178.157.90 (25 Jan 2008 12:53:53 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail