static IP address
-
can anybody tell me how to set static IP address using c++ code using win32 API.I am doing it in following way: InitializeWMI(); const BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration"); const BSTR AdapterName = SysAllocString(ADAPTER_INDEX); const BSTR MethodName = SysAllocString(L"EnableStatic"); IWbemClassObject* pClassObj = NULL; IWbemClassObject* pInClass = NULL; IWbemClassObject* pInInstClass = NULL; IWbemServices *pSvc = NULL ; LONG index[1]={0}; HRESULT hr = pSvc->GetObject(ClassName,0,NULL,&pClassObj,NULL);///at this point its showing unhandled exception can anybody help???
-
can anybody tell me how to set static IP address using c++ code using win32 API.I am doing it in following way: InitializeWMI(); const BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration"); const BSTR AdapterName = SysAllocString(ADAPTER_INDEX); const BSTR MethodName = SysAllocString(L"EnableStatic"); IWbemClassObject* pClassObj = NULL; IWbemClassObject* pInClass = NULL; IWbemClassObject* pInInstClass = NULL; IWbemServices *pSvc = NULL ; LONG index[1]={0}; HRESULT hr = pSvc->GetObject(ClassName,0,NULL,&pClassObj,NULL);///at this point its showing unhandled exception can anybody help???
an89 wrote:
InitializeWMI(); const BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration"); const BSTR AdapterName = SysAllocString(ADAPTER_INDEX); const BSTR MethodName = SysAllocString(L"EnableStatic"); IWbemClassObject* pClassObj = NULL; IWbemClassObject* pInClass = NULL; IWbemClassObject* pInInstClass = NULL;
IWbemServices *pSvc = NULL
; LONG index[1]={0}; HRESULT hr =pSvc->GetObject
(ClassName,0,NULL,&pClassObj,NULL);///at this point its showing unhandled exceptionWell, for starters it looks like
pSvc
is stillNULL
so that would cause the exception... Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles