Click here to Skip to main content
15,922,696 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMFC Group box Pin
shijuck12-Sep-05 1:44
shijuck12-Sep-05 1:44 
AnswerRe: MFC Group box Pin
toxcct12-Sep-05 1:53
toxcct12-Sep-05 1:53 
AnswerRe: MFC Group box Pin
Niklas L12-Sep-05 2:53
Niklas L12-Sep-05 2:53 
AnswerRe: MFC Group box Pin
David Crow12-Sep-05 3:08
David Crow12-Sep-05 3:08 
QuestionCompilation Error From VC 6.0 to VC 7.1 Pin
Identity Undisclosed12-Sep-05 1:37
Identity Undisclosed12-Sep-05 1:37 
AnswerRe: Compilation Error From VC 6.0 to VC 7.1 Pin
toxcct12-Sep-05 1:44
toxcct12-Sep-05 1:44 
GeneralRe: Compilation Error From VC 6.0 to VC 7.1 Pin
Identity Undisclosed12-Sep-05 20:00
Identity Undisclosed12-Sep-05 20:00 
QuestionWMI,IPAddress,SubnetMask setting! Doesn't work. Pin
Tcpip200512-Sep-05 1:36
Tcpip200512-Sep-05 1:36 
I used the function bellow:

HRESULT ConfigNet()
{

IWbemLocator *pLocator=NULL;
IWbemServices *pNamespace=NULL;
IWbemClassObject *pClass=NULL;
IWbemClassObject *pInputParamClass=NULL;
IWbemClassObject *pInputParamInstance=NULL;
IWbemClassObject * pOutInst = NULL;
BSTR InstancePath = SysAllocString(L"Win32_NetworkAdapterConfiguration=2");
HRESULT hr;
BSTR Path = SysAllocString(L"\\\\MyComputerName\\root\\cimv2");
BSTR ClassPath = SysAllocString(L"Win32_NetworkAdapterConfiguration");
BSTR MethodName = SysAllocString(L"EnableStatic");
LPCWSTR Arg1Name = L"IPAddress";
VARIANT var1;
LPCWSTR Arg2Name = L"SubnetMask";
VARIANT var2;
__try
{
CreateOneElementBstrArray(&var1, L"10.0.0.101");
CreateOneElementBstrArray(&var2, L"255.255.255.0");

CoCreateInstance(CLSID_WbemLocator, 0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID*)&pLocator);

hr = pLocator->ConnectServer(Path,NULL, NULL, NULL, 0, NULL, NULL,
&pNamespace);

hr = CoSetProxyBlanket( pNamespace,
RPC_C_AUTHN_WINNT,
RPC_C_AUTHZ_NONE,
NULL,
RPC_C_AUTHN_LEVEL_CALL,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE);

if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pNamespace->GetObject(ClassPath, 0, NULL, &pClass, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pClass->GetMethod(MethodName, 0, &pInputParamClass, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamClass->SpawnInstance(0, &pInputParamInstance);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamInstance->Put(Arg1Name, 0, &var1, 0);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pInputParamInstance->Put(Arg2Name, 0, &var2, 0);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
if(SUCCEEDED(hr))
{
hr = pNamespace->ExecMethod(InstancePath, MethodName, 0, NULL,
pInputParamInstance, &pOutInst, NULL);
}
if(!SUCCEEDED(hr))
{
PrintWMIError(hr);
return hr;
}
}
__finally
{
if(pInputParamInstance)
pInputParamInstance->Release();
if(pInputParamClass)
pInputParamClass->Release();
if(pClass)
pClass->Release();
if(pNamespace)
pNamespace->Release();
if(pLocator)
pLocator->Release();
}
return hr;
}

every function works well. but nothing changed.
Why??
BSTR Path = SysAllocString(L"\\\\MyComputerName\\root\\cimv2");
for a test,the above line must be modified.replace "MyComputerName" with your own computer name.

Thank you everyone.
AnswerRe: WMI,IPAddress,SubnetMask setting! Doesn't work. Pin
Tcpip200512-Sep-05 1:39
Tcpip200512-Sep-05 1:39 
QuestionVolume Control through program.... Pin
ashwath200512-Sep-05 1:17
ashwath200512-Sep-05 1:17 
AnswerRe: Volume Control through program.... Pin
David Crow12-Sep-05 3:10
David Crow12-Sep-05 3:10 
QuestionRe: Volume Control through program.... Pin
ashwath200512-Sep-05 4:29
ashwath200512-Sep-05 4:29 
AnswerRe: Volume Control through program.... Pin
David Crow12-Sep-05 4:39
David Crow12-Sep-05 4:39 
GeneralRe: Volume Control through program.... Pin
ashwath200512-Sep-05 18:33
ashwath200512-Sep-05 18:33 
GeneralRe: Volume Control through program.... Pin
David Crow19-Sep-05 7:25
David Crow19-Sep-05 7:25 
Questionpassing reference to vector in dll function Pin
Anonymous12-Sep-05 1:15
Anonymous12-Sep-05 1:15 
AnswerRe: passing reference to vector in dll function Pin
ab8lam12-Sep-05 1:49
ab8lam12-Sep-05 1:49 
AnswerRe: passing reference to vector in dll function Pin
Nemanja Trifunovic12-Sep-05 2:17
Nemanja Trifunovic12-Sep-05 2:17 
QuestionGraphics.MeasureString word wrap problem Pin
Kramer_198212-Sep-05 1:13
Kramer_198212-Sep-05 1:13 
QuestionOutlined Font in Direct3D ? Pin
Danoo12-Sep-05 1:10
Danoo12-Sep-05 1:10 
QuestionSystem Menu in MFC -Plz Help Pin
parims12-Sep-05 0:45
parims12-Sep-05 0:45 
AnswerRe: System Menu in MFC -Plz Help Pin
toxcct12-Sep-05 0:50
toxcct12-Sep-05 0:50 
Questionwhat does the MapViewOfFile do exactly?? Pin
Anonymous12-Sep-05 0:42
Anonymous12-Sep-05 0:42 
AnswerRe: what does the MapViewOfFile do exactly?? Pin
Niklas L12-Sep-05 3:06
Niklas L12-Sep-05 3:06 
GeneralRe: what does the MapViewOfFile do exactly?? Pin
namaskaaram12-Sep-05 4:02
namaskaaram12-Sep-05 4:02 

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.