全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:6842
推到 Plurk!
推到 Facebook!

如何取得pc上COM port數量

尚未結案
sge
一般會員


發表:5
回覆:2
積分:1
註冊:2002-12-19

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-06-25 18:14:01 IP:61.64.xxx.xxx 未訂閱
請教各位大大: 要如何取得電腦上COM port的數量?(實際硬體或一定USB虛擬的) 有什麼函式或方法可使用? 用kTop搜尋,找不到合適的主題 感謝你的回覆!!!
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-06-25 19:03:18 IP:61.218.xxx.xxx 未訂閱
引言: 請教各位大大: 要如何取得電腦上COM port的數量?(實際硬體或一定USB虛擬的) 有什麼函式或方法可使用? 用kTop搜尋,找不到合適的主題 感謝你的回覆!!!
在Registry中可以查到內建的Com Port數量 HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM HAVE A NICE DAY FOR YOU
gwanlin
一般會員


發表:1
回覆:29
積分:6
註冊:2002-07-30

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-01-27 17:26:52 IP:220.130.xxx.xxx 未訂閱
本來也想問這個問題,不過看到這篇以後去MSDN找到讀registry key的sample code,po出來以饗同好。    
 
Using the Registry
The following example demonstrates the use of the RegQueryInfoKey, RegEnumKey, and RegEnumValue functions. The hKey parameter passed to each function is a handle to an open key. This key must be opened before the function call and closed afterward.     // QueryKey - enumerates the subkeys of a given key and the associated 
//    values and then copies the information about the keys and values 
//    into a pair of edit controls and list boxes. 
// hDlg - dialog box that contains the edit controls and list boxes 
// hKey - key whose subkeys and values are to be enumerated 
 
VOID QueryKey(HWND hDlg, HANDLE hKey) 
{ 
    CHAR     achKey[MAX_PATH]; 
    CHAR     achClass[MAX_PATH] = "";  // buffer for class name 
    DWORD    cchClassName = MAX_PATH;  // length of class string 
    DWORD    cSubKeys;                 // number of subkeys 
    DWORD    cbMaxSubKey;              // longest subkey size 
    DWORD    cchMaxClass;              // longest class string 
    DWORD    cValues;              // number of values for key 
    DWORD    cchMaxValue;          // longest value name 
    DWORD    cbMaxValueData;       // longest value data 
    DWORD    cbSecurityDescriptor; // size of security descriptor 
    FILETIME ftLastWriteTime;      // last write time 
 
    DWORD i, j; 
    DWORD retCode, retValue; 
 
    CHAR  achValue[MAX_VALUE_NAME]; 
    DWORD cchValue = MAX_VALUE_NAME; 
    CHAR  achBuff[80]; 
 
    // Get the class name and the value count. 
    RegQueryInfoKey(hKey,        // key handle 
        achClass,                // buffer for class name 
        &cchClassName,           // length of class string 
        NULL,                    // reserved 
        &cSubKeys,               // number of subkeys 
        &cbMaxSubKey,            // longest subkey size 
        &cchMaxClass,            // longest class string 
        &cValues,                // number of values for this key 
        &cchMaxValue,            // longest value name 
        &cbMaxValueData,         // longest value data 
        &cbSecurityDescriptor,   // security descriptor 
        &ftLastWriteTime);       // last write time 
 
    SetDlgItemText(hDlg, IDE_CLASS, achClass); 
    SetDlgItemInt(hDlg, IDE_CVALUES, cValues, FALSE); 
 
    SendMessage(GetDlgItem(hDlg, IDL_LISTBOX), 
        LB_ADDSTRING, 0, (LONG) ".."); 
 
    // Enumerate the child keys, looping until RegEnumKey fails. Then 
    // get the name of each child key and copy it into the list box.         SetCursor(LoadCursor(NULL, IDC_WAIT)); 
    for (i = 0, retCode = ERROR_SUCCESS; 
            retCode == ERROR_SUCCESS; i  ) 
    { 
        retCode = RegEnumKey(hKey, i, achKey, MAX_PATH); 
        if (retCode == (DWORD)ERROR_SUCCESS) 
        {
            SendMessage(GetDlgItem(hDlg, IDL_LISTBOX), 
                LB_ADDSTRING, 0, (LONG) achKey); 
        }
    } 
    SetCursor(LoadCursor (NULL, IDC_ARROW)); 
 
    // Enumerate the key values. 
    SetCursor(LoadCursor(NULL, IDC_WAIT)); 
 
    if (cValues) 
    {
        for (j = 0, retValue = ERROR_SUCCESS; 
                j < cValues; j  ) 
        { 
            cchValue = MAX_VALUE_NAME; 
            achValue[0] = '\0'; 
            retValue = RegEnumValue(hKey, j, achValue, 
                &cchValue, 
                NULL, 
                NULL,    // &dwType, 
                NULL,    // &bData, 
                NULL);   // &bcData 
 
            if (retValue != (DWORD) ERROR_SUCCESS && 
                    retValue != ERROR_INSUFFICIENT_BUFFER) 
            { 
                wsprintf (achBuff, 
                    "Line:%d 0 based index = %d, retValue = %d, " 
                     "ValueLen = %d", 
                     __LINE__, j, retValue, cchValue); 
                MessageBox (hDlg, achBuff, "Debug", MB_OK); 
            } 
 
            achBuff[0] = '\0'; 
 
            // Add each value to a list box. 
            if (!lstrlen(achValue)) 
                lstrcpy(achValue, ""); 
            wsprintf(achBuff, "%d) %s ", j, achValue); 
            SendMessage(GetDlgItem(hDlg,IDL_LISTBOX2), 
                LB_ADDSTRING, 0, (LONG) achBuff); 
        } 
 
    SetCursor(LoadCursor(NULL, IDC_ARROW)); 
} 
我是gwanlin 發表人 - gwanlin 於 2005/01/27 19:11:34
------
我是gwanlin
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-01-28 14:06:37 IP:60.248.xxx.xxx 未訂閱
其實透過WMI也能取得COM Port的相關資訊 範例下載:http://delphi.ktop.com.tw/loadfile.php?TOPICID=20160030&CC=450870
unit1.H
//---------------------------------------------------------------------------    #ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include 
#include 
#include 
#include <Forms.hpp>    #include 
#include 
#include 
#include 
#include     //---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:        // IDE-managed Components
        TButton *Button1;
        TListBox *ListBox1;
        TLabel *Label1;
        TButton *Button2;
        TButton *Button3;
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall ListBox1Click(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall Button3Click(TObject *Sender);
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:        // User declarations
public:                // User declarations
IWbemClassObject *pSerialDev;
IEnumWbemClassObject *pEnum;
IWbemServices *pSvc;
IWbemLocator *pLoc;
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif    unit1.cpp
//---------------------------------------------------------------------------    #include 
#pragma hdrstop    #include "Unit1.h"
#include "Unit2.h"
#include "Unit3.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
      pEnum=0;
      pSvc=0;
      pLoc=0;
      pSerialDev=0;
}
//---------------------------------------------------------------------------    void __fastcall TForm1::Button1Click(TObject *Sender)
{
Button1->Enabled=false;
HRESULT hres;    hres = CoInitializeEx(0, COINIT_MULTITHREADED); //Initialize COM.    if (FAILED(hres))
   { ShowMessage("Failed to initialize COM library. Error code = "+IntToHex((int)hres,8));
     Application->Terminate();
   }
hres =  CoInitializeSecurity(
  NULL,         // security descriptor
  -1,           // use this simple setting
  NULL,         // use this simple setting
  NULL,         // reserved
  RPC_C_AUTHN_LEVEL_CONNECT,     // Windows NT 4/Windows 2000 authentication level
  RPC_C_IMP_LEVEL_IMPERSONATE,   // impersonation level
  NULL,         // use this simple setting
  EOAC_NONE,    // no special capabilities
  0);           // reserved      if (FAILED(hres))
  {
     ShowMessage("Failed to initialize security. Error code = "+IntToHex((int)hres,8));
     CoUninitialize();
     Application->Terminate();
  }    //IWbemLocator interface for obtaining the initial namespace pointer to
//the Windows Management on a particular host computer.
    hres = CoCreateInstance(CLSID_WbemLocator, 0,
        CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLoc);        if (FAILED(hres))
    {
     ShowMessage("Failed to create IWbemLocator object. Err code = "+IntToHex((int)hres,8));
     CoUninitialize();
     Application->Terminate();
    }        hres = pLoc->ConnectServer(
            L"\\\\.\\root\\cimv2",
            NULL, NULL, 0, NULL, 0, 0, &pSvc);        if (FAILED(hres))
    {
     ShowMessage("Could not connect. Error code = "+IntToHex((int)hres,8));
     CoUninitialize();
     Application->Terminate();
    }    // Set the proxy so that impersonation of the client occurs.
hres = CoSetProxyBlanket(pSvc,
  RPC_C_AUTHN_WINNT,    // NTLM authentication service
  RPC_C_AUTHZ_NONE,     // default authorization service...
  NULL,                 // no mutual authentication
  RPC_C_AUTHN_LEVEL_CONNECT,      // authentication level
  RPC_C_IMP_LEVEL_IMPERSONATE,    // impersonation level
  NULL,                // use current token
  EOAC_NONE);          // no special capabilities            if (FAILED(hres))
    {
      ShowMessage("Could not set proxy blanket. Error code = "+IntToHex((int)hres,8));
      pSvc->Release();
      pLoc->Release();
      CoUninitialize();
      Application->Terminate();
    }    //Win32_SerialPort - WMI class that contains information about serial ports
BSTR className = SysAllocString(L"Win32_SerialPort");      hres = pSvc->GetObject(className, 0, NULL, &pSerialDev, NULL );
//Retrieves an class object.      ULONG puReturned;    //Create instance for enumeration ports      hres=pSvc->CreateInstanceEnum(
  className,
  NULL,
  NULL,
  &pEnum
);    //no need in variable className now.
SysFreeString(className);        if (hres != 0)
    {
        ShowMessage("Error");
        Application->Terminate();
    }        // Retrieve the objects in the result set.
    for (;;)
    {
        VARIANT Val;
        CIMTYPE pvtType;
        ULONG uReturned = 0;            VariantInit(&Val);            hres = pEnum->Next(
            WBEM_INFINITE,                  // Time out
            1,                  // One object
            &pSerialDev,
            &uReturned
            );            if (uReturned == 0)
            break;            //get name for every port and add it in the list box...
        BSTR Name = SysAllocString(L"Name");
        pSerialDev->Get(Name,0,&Val,&pvtType,NULL);
        LPSTR SS=WideToAnsi(Val.bstrVal);
        ListBox1->Items->Add(SS);
        SysFreeString(Name);
        delete []SS;
        //... and free it.            VariantClear(&Val);
    }    }
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1Click(TObject *Sender)
{
if(ListBox1->ItemIndex >= 0)Form2->ShowModal();
}
//---------------------------------------------------------------------------    void __fastcall TForm1::Button2Click(TObject *Sender)
{
Close();        
}
//---------------------------------------------------------------------------    void __fastcall TForm1::Button3Click(TObject *Sender)
{
Form3->ShowModal();        
}
//---------------------------------------------------------------------------    void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
    // All done.
if(pEnum)pEnum->Release();
if(pSvc)pSvc->Release();
if(pLoc)pLoc->Release();
if(pSerialDev)pSerialDev->Release();
CoUninitialize();
}
//---------------------------------------------------------------------------    Unit2.H
//---------------------------------------------------------------------------    #ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include 
#include 
#include 
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published:        // IDE-managed Components
        TLabel *Label1;
        TEdit *Edit1;
        TLabel *Label2;
        TEdit *Edit2;
        TLabel *Label5;
        TLabel *Label6;
        TLabel *Label7;
        TLabel *Label8;
        TLabel *Label9;
        TLabel *Label10;
        TEdit *Edit5;
        TEdit *Edit6;
        TLabel *Label16;
        TEdit *Edit7;
        TEdit *Edit8;
        TEdit *Edit9;
        TEdit *Edit10;
        TEdit *Edit16;
        TLabel *Label17;
        TLabel *Label19;
        TLabel *Label20;
        TLabel *Label21;
        TEdit *Edit17;
        TEdit *Edit19;
        TEdit *Edit20;
        TEdit *Edit21;
        TLabel *Label23;
        TLabel *Label25;
        TLabel *Label26;
        TLabel *Label27;
        TLabel *Label28;
        TLabel *Label29;
        TLabel *Label30;
        TLabel *Label31;
        TLabel *Label32;
        TEdit *Edit23;
        TEdit *Edit25;
        TEdit *Edit26;
        TEdit *Edit27;
        TEdit *Edit28;
        TEdit *Edit30;
        TEdit *Edit29;
        TEdit *Edit31;
        TEdit *Edit32;
        TLabel *Label33;
        TLabel *Label34;
        TLabel *Label35;
        TLabel *Label36;
        TLabel *Label37;
        TLabel *Label38;
        TLabel *Label39;
        TLabel *Label40;
        TLabel *Label41;
        TLabel *Label42;
        TLabel *Label43;
        TLabel *Label44;
        TLabel *Label45;
        TLabel *Label46;
        TEdit *Edit33;
        TEdit *Edit34;
        TEdit *Edit35;
        TEdit *Edit36;
        TEdit *Edit37;
        TEdit *Edit38;
        TEdit *Edit39;
        TEdit *Edit41;
        TEdit *Edit40;
        TEdit *Edit42;
        TEdit *Edit43;
        TEdit *Edit44;
        TEdit *Edit46;
        TButton *Button2;
        TEdit *Edit45;
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall FormActivate(TObject *Sender);
private:        // User declarations
public:                // User declarations
        __fastcall TForm2(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//---------------------------------------------------------------------------
#endif    Unit2.CPP
//---------------------------------------------------------------------------    #include 
#pragma hdrstop    #include "Unit2.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------    void __fastcall TForm2::Button2Click(TObject *Sender)
{
Close();        
}
//---------------------------------------------------------------------------    void __fastcall TForm2::FormActivate(TObject *Sender)
{    VARIANT Val;
VariantInit(&Val);
        HRESULT hres;
hres = Form1->pEnum->Reset();    for(int i=0;; ++i)
{
        ULONG uReturned = 0;            hres = Form1->pEnum->Next(
            0,                  // Time out
            1,                  // One object
            &(Form1->pSerialDev),
            &uReturned
            );            if (uReturned == 0)
            break;
        if(i != Form1->ListBox1->ItemIndex)continue;    LPSTR TmpString;    CIMTYPE pvtType;
VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"Availability",0,&Val,&pvtType,NULL);
switch(Val.iVal)
{
case 1:  Edit1->Text="Other";break;
case 2:  Edit1->Text="Unknown";break;
case 3:  Edit1->Text="Running/Full Power";break;
case 4:  Edit1->Text="Warning";break;
case 5:  Edit1->Text="In Test";break;
case 6:  Edit1->Text="Not Applicable";break;
case 7:  Edit1->Text="Power Off";break;
case 8:  Edit1->Text="Off Line";break;
case 9:  Edit1->Text="Off Duty";break;
case 10:  Edit1->Text="Degraded";break;
case 11:  Edit1->Text="Not Installed";break;
case 12:  Edit1->Text="Install Error";break;
case 13:  Edit1->Text="Power Save - Unknown";break;
case 14:  Edit1->Text="Power Save - Low Power Mode";break;
case 15:  Edit1->Text="Power Save - Standby";break;
case 16:  Edit1->Text="Power Cycle";break;
case 17:  Edit1->Text="Power Save - Warning";break;
default: Edit1->Text="Unknown";
};
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"Binary",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit2->Text="True";
   else Edit2->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"Caption",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit5->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"ConfigManagerErrorCode",0,&Val,&pvtType,NULL);
Edit6->Text=IntToStr(Val.uintVal);
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"ConfigManagerUserConfig",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit7->Text="True";
   else Edit7->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"CreationClassName",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit8->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"Description",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit9->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"DeviceID",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit10->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"MaximumInputBufferSize",0,&Val,&pvtType,NULL);
Edit16->Text=IntToStr(Val.uintVal);
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"MaximumOutputBufferSize",0,&Val,&pvtType,NULL);
Edit17->Text=IntToStr(Val.uintVal);
VariantClear(&Val);    VariantInit(&Val);
Form1->pSerialDev->Get(L"Name",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit19->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"OSAutoDiscovered",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit20->Text="True";
   else Edit20->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"PNPDeviceID",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit21->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"PowerManagementSupported",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit23->Text="True";
   else Edit23->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"ProviderType",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit25->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SettableBaudRate",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit26->Text="True";
   else Edit26->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SettableDataBits",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit27->Text="True";
   else Edit27->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SettableFlowControl",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit28->Text="True";
   else Edit28->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SettableParity",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit29->Text="True";
   else Edit29->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SettableParityCheck",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit30->Text="True";
   else Edit30->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SettableRLSD",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit31->Text="True";
   else Edit31->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SettableStopBits",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit32->Text="True";
   else Edit32->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"Status",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit33->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"StatusInfo",0,&Val,&pvtType,NULL);
switch(Val.iVal)
{
case 1:  Edit34->Text="Other";break;
case 2:  Edit34->Text="Unknown";break;
case 3:  Edit34->Text="Enabled";break;
case 4:  Edit34->Text="Disabled";break;
case 5:  Edit34->Text="Not Applicable";break;
default: Edit34->Text="Unknown";
};
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"Supports16BitMode",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit35->Text="True";
   else Edit35->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsDTRDSR",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit36->Text="True";
   else Edit36->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsElapsedTimeouts",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit37->Text="True";
   else Edit37->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsIntTimeouts",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit38->Text="True";
   else Edit38->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsParityCheck",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit39->Text="True";
   else Edit39->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsRLSD",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit40->Text="True";
   else Edit40->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsRTSCTS",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit41->Text="True";
   else Edit41->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsSpecialCharacters",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit42->Text="True";
   else Edit42->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsXOnXOff",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit43->Text="True";
   else Edit43->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SupportsXOnXOffSet",0,&Val,&pvtType,NULL);
if(Val.boolVal)Edit44->Text="True";
   else Edit44->Text="False";
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SystemCreationClassName",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit45->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    VariantInit(&Val);
hres=Form1->pSerialDev->Get(L"SystemName",0,&Val,&pvtType,NULL);
TmpString=WideToAnsi(Val.bstrVal);
Edit46->Text=TmpString;
delete []TmpString;
VariantClear(&Val);    break;
}
}
//---------------------------------------------------------------------------    
/*生活是一種藝術,用心生活享受生活*/
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#5 引用回覆 回覆 發表時間:2005-01-28 14:09:21 IP:60.248.xxx.xxx 未訂閱
因網路問題重複Post了....請刪除! 發表人 - axsoft 於 2005/01/28 14:16:01
系統時間:2024-12-05 2:55:10
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!