Joao Rego
2006-01-06 10:04:01 UTC
Hello,
Using VisualStudio 2003 and C language.
I'm writing a service to get infromation from the system through WMI.
I want to get IPAddress from Win32_NetworkAdapterConfiguration.
I started from the sample
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/example__getting_wmi_data_from_the_local_computer.asp
The point is that IPAddress is a string array:
....
IWbemClassObject *pclsObj;
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
VARIANT vtProp;
VariantInit(&vtProp);
// Get the value of the property
hr = pclsObj->Get(L"IPAddress", 0, &vtProp, 0, 0);
...
How do I get the IP's from the vtProp?
The following does not work with the string[] data type of IPAddress:
szIPAddress char[128];
sprintf(svIpAddress, "IPAddress : %s", W2A(vtProp.bstrVal));
Thanks for any help on this question.
João Rêgo
Using VisualStudio 2003 and C language.
I'm writing a service to get infromation from the system through WMI.
I want to get IPAddress from Win32_NetworkAdapterConfiguration.
I started from the sample
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/example__getting_wmi_data_from_the_local_computer.asp
The point is that IPAddress is a string array:
....
IWbemClassObject *pclsObj;
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
VARIANT vtProp;
VariantInit(&vtProp);
// Get the value of the property
hr = pclsObj->Get(L"IPAddress", 0, &vtProp, 0, 0);
...
How do I get the IP's from the vtProp?
The following does not work with the string[] data type of IPAddress:
szIPAddress char[128];
sprintf(svIpAddress, "IPAddress : %s", W2A(vtProp.bstrVal));
Thanks for any help on this question.
João Rêgo