Hi Bob,

No humour intended (!), here's some C++ code, it's really very simple, sadly 
some formatting will be lost in the mail below. This really is the most 
fool-proof way of listing COM ports which exist on a computer:

for (UINT nPort = 1; nPort <= 255; nPort++)
{
    //
    // Form the Raw device name.
    //
    CString strPort;
    strPort.Format(_T("COM%d"), nPort);

    COMMCONFIG cc     = {0};
    DWORD      dwSize = sizeof(COMMCONFIG);

    if (GetDefaultCommConfig(strPort, &cc, &dwSize))
    {
        //  Add strPort to the list
    }
}


Simon Brown
---
http://blog.hb9drv.ch/

"There are two major products that came out of Berkeley: LSD and UNIX. We
don't believe this to be a coincidence."
- Jeremy S. Anderson

----- Original Message ----- 
From: "Bob McGwier N4HY" <[EMAIL PROTECTED]>

> Simon:
>
> By the time I figured out the 30-th or was it 40-th value to put into a 
> struct member to use this routine,  I decided to stick with what we have. 
> I know you have a wicked sense of humor but I missed the humor here 
> altogether  :-P .  We can modify what we have on the try/catch approach to 
> parse the error to tell if it is nonexistent or in use and the somehow 
> color or grey or whatever the ones that are in use.
>


_______________________________________________
FlexRadio mailing list
FlexRadio@flex-radio.biz
http://mail.flex-radio.biz/mailman/listinfo/flexradio_flex-radio.biz
Archive Link: http://mail.flex-radio.biz/pipermail/flexradio_flex-radio.biz/
FlexRadio Homepage: http://www.flex-radio.com

Reply via email to