Click here to Skip to main content
15,908,264 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to speed up copy of .txt files into arrays? Pin
led mike5-Apr-07 8:54
led mike5-Apr-07 8:54 
GeneralRe: How to speed up copy of .txt files into arrays? Pin
Arris745-Apr-07 9:20
Arris745-Apr-07 9:20 
GeneralRe: How to speed up copy of .txt files into arrays? Pin
Arris745-Apr-07 9:33
Arris745-Apr-07 9:33 
QuestionSCSI_PASS_THROUGH_DIRECT problems Pin
FoxholeWilly5-Apr-07 5:07
FoxholeWilly5-Apr-07 5:07 
QuestionWMI Pin
saisp5-Apr-07 4:48
saisp5-Apr-07 4:48 
QuestionRe: WMI Pin
David Crow5-Apr-07 6:05
David Crow5-Apr-07 6:05 
AnswerRe: WMI Pin
saisp5-Apr-07 7:04
saisp5-Apr-07 7:04 
GeneralRe: WMI Pin
David Crow5-Apr-07 7:19
David Crow5-Apr-07 7:19 
saisp wrote:
but how to get ipaddress and subnet from wmi.


I use:

IWbemServices *pService = NULL;
IEnumWbemClassObject *pEnum = NULL;
...
HRESULT hr = pService->CreateInstanceEnum(_bstr_t("Win32_NetworkAdapterConfiguration"),
                                          WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, 
                                          NULL, &pEnum);
 
if (WBEM_S_NO_ERROR == hr)
{
    IWbemClassObject *pClass = NULL;
    ULONG ulReturned;

    hr = pEnum->Next(WBEM_INFINITE, 1, &pClass, &ulReturned);
    if (WBEM_S_NO_ERROR == hr)
    {
        _variant_t v;
        hr = pClass->Get(L"IPAddress", 0, &v, NULL, NULL);
        if (VT_NULL != v.vt)
        {
            LONG lBound;
            BSTR Value;
            SafeArrayGetUBound(V_ARRAY(&v), 1, &lBound);
            while (lBound >= 0)
            {
                SafeArrayGetElement(V_ARRAY(&v), &lBound, &Value);
                TRACE("IPAddress[%u] = %S\n", lBound, Value);
                lBound--;
            }
        }
         
        hr = pClass->Get(L"IPSubnet", 0, &v, NULL, NULL);
        if (VT_NULL != v.vt)
        {
            LONG lBound;
            BSTR Value;
            SafeArrayGetUBound(V_ARRAY(&v), 1, &lBound);
            while (lBound >= 0)
            {
                SafeArrayGetElement(V_ARRAY(&v), &lBound, &Value);
                TRACE("IPSubnet[%u] = %S\n", lBound, Value);
                lBound--;
            }
        }
    }
}



"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

"Judge not by the eye but by the heart." - Native American Proverb


GeneralRe: WMI Pin
saisp5-Apr-07 7:51
saisp5-Apr-07 7:51 
GeneralRe: WMI Pin
David Crow5-Apr-07 8:03
David Crow5-Apr-07 8:03 
GeneralRe: WMI Pin
saisp5-Apr-07 8:11
saisp5-Apr-07 8:11 
GeneralRe: WMI Pin
David Crow5-Apr-07 8:17
David Crow5-Apr-07 8:17 
GeneralRe: WMI Pin
saisp5-Apr-07 8:21
saisp5-Apr-07 8:21 
QuestionRe: WMI Pin
David Crow5-Apr-07 8:28
David Crow5-Apr-07 8:28 
GeneralRe: WMI Pin
David Crow5-Apr-07 8:35
David Crow5-Apr-07 8:35 
GeneralRe: WMI Pin
saisp5-Apr-07 8:48
saisp5-Apr-07 8:48 
GeneralRe: WMI Pin
David Crow5-Apr-07 8:49
David Crow5-Apr-07 8:49 
GeneralRe: WMI Pin
David Crow5-Apr-07 9:45
David Crow5-Apr-07 9:45 
GeneralRe: WMI Pin
saisp5-Apr-07 18:53
saisp5-Apr-07 18:53 
GeneralRe: WMI [modified] Pin
cp98765-Apr-07 18:58
cp98765-Apr-07 18:58 
GeneralRe: WMI Pin
deeps_cute5-Apr-07 19:31
deeps_cute5-Apr-07 19:31 
GeneralRe: WMI Pin
cp98765-Apr-07 19:41
cp98765-Apr-07 19:41 
GeneralRe: WMI Pin
David Crow6-Apr-07 2:36
David Crow6-Apr-07 2:36 
QuestionHow to convert BDF files to XML file ? Pin
black_puma5-Apr-07 4:01
black_puma5-Apr-07 4:01 
QuestionAppVerifier Pin
Try5-Apr-07 3:37
Try5-Apr-07 3:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.