Click here to Skip to main content
16,012,223 members
Home / Discussions / COM
   

COM

 
QuestionConvert pdf to tiff Pin
Dudi Avramov20-Nov-06 3:57
Dudi Avramov20-Nov-06 3:57 
QuestionNewWIndow2 Event Sink problem Pin
yokos117-Nov-06 12:26
yokos117-Nov-06 12:26 
GeneralRe: NewWIndow2 Event Sink problem Pin
prasad_som19-Nov-06 18:31
prasad_som19-Nov-06 18:31 
Questionmemory issues Releasing Interface in VB 6 Pin
el_scrub16-Nov-06 22:34
el_scrub16-Nov-06 22:34 
AnswerRe: memory issues Releasing Interface in VB 6 Pin
prasad_som16-Nov-06 23:19
prasad_som16-Nov-06 23:19 
GeneralRe: memory issues Releasing Interface in VB 6 Pin
el_scrub16-Nov-06 23:38
el_scrub16-Nov-06 23:38 
GeneralRe: memory issues Releasing Interface in VB 6 Pin
prasad_som17-Nov-06 1:08
prasad_som17-Nov-06 1:08 
QuestionKilling Process Using WMI Pin
abhiramsss16-Nov-06 6:20
abhiramsss16-Nov-06 6:20 
hi
I am working killing a process using WMI iam using the following code .


HRESULT hres;

BSTR ClassName = SysAllocString(L"Win32_Process");

/* YOU NEED TO CHANGE THE NUMBER VALUE OF THE HANDLE
(PROCESS ID) TO THE CORRECT VALUE OF THE PROCESS YOU
ARE TRYING TO TERMINATE (this provides a path to
the class instance you are tying to terminate). */
BSTR ClassNameInstance = SysAllocString(
L"Win32_Process.Handle=\"\1418\"");

_bstr_t MethodName = (L"Terminate");
BSTR ParameterName = SysAllocString(L"Reason");

IWbemClassObject* pClass = NULL;
hres = m_pIWbemService->GetObject(ClassName, 0, NULL, &pClass, NULL);

IWbemClassObject* pInParamsDefinition = NULL;
IWbemClassObject* pOutMethod = NULL;
hres = pClass->GetMethod(MethodName, 0,
&pInParamsDefinition, &pOutMethod);

if (FAILED(hres))
{
cout << "Could not get the method. Error code = 0x"
<< hex << hres << endl;
}

IWbemClassObject* pClassInstance = NULL;
hres = pInParamsDefinition->SpawnInstance(0, &pClassInstance);

// Create the values for the in parameters
VARIANT pcVal;
VariantInit(&pcVal);
V_VT(&pcVal) = VT_I4;

// Store the value for the in parameters
hres = pClassInstance->Put(L"Reason", 0,
&pcVal, 0);

// Execute Method
hres = m_pIWbemService->ExecMethod(ClassNameInstance, MethodName, 0,
NULL, pClassInstance, NULL, NULL);

if (FAILED(hres))
{
cout << "Could not execute method. Error code = 0x"
<< hex << hres << endl;
VariantClear(&pcVal);
SysFreeString(ClassName);
SysFreeString(MethodName);
pClass->Release();
pInParamsDefinition->Release();
m_pIWbemService->Release();
//pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}


it is working fine ,but here iam gicing the Process ID which has to be terminated like 1418.

Instead of ProcessID i want to use process Name like CAlc.exe or notepad.exe

but when IAm tring to change the code with the process name like

SysAllocString(
L"Win32_Process.Name=\"\notepad.exe\"");

notepad is not terminating . can you please help me to solve it.

Thanks in Advance

abhi

QuestionA quesion about IE7 Pin
Armor Wei14-Nov-06 19:17
Armor Wei14-Nov-06 19:17 
AnswerRe: A quesion about IE7 Pin
Stephen Hewitt14-Nov-06 20:07
Stephen Hewitt14-Nov-06 20:07 
GeneralRe: A quesion about IE7 Pin
Armor Wei14-Nov-06 20:24
Armor Wei14-Nov-06 20:24 
Questionregarding connection points Pin
srinivas nch13-Nov-06 19:36
srinivas nch13-Nov-06 19:36 
QuestionOLE Afx Control erros Pin
earlgraham13-Nov-06 7:47
earlgraham13-Nov-06 7:47 
QuestionDataGrid in MFC? Pin
Franken13-Nov-06 1:23
Franken13-Nov-06 1:23 
Questionquestion about activex compability Pin
ingsgr01@gmail.com13-Nov-06 0:47
ingsgr01@gmail.com13-Nov-06 0:47 
QuestionHow can I let DCOM server be visited through internet? Pin
johnsonwen11-Nov-06 22:13
johnsonwen11-Nov-06 22:13 
QuestionBSTR thru COM does not seem to be passed..... Pin
morenz10-Nov-06 9:17
morenz10-Nov-06 9:17 
QuestionRe: BSTR thru COM does not seem to be passed..... [modified] Pin
prasad_som13-Nov-06 22:08
prasad_som13-Nov-06 22:08 
AnswerRe: BSTR thru COM does not seem to be passed..... Pin
morenz21-Nov-06 5:37
morenz21-Nov-06 5:37 
Question.net addin outlook Pin
K edar V10-Nov-06 0:39
K edar V10-Nov-06 0:39 
QuestionCOM Inheritance Pin
Inactive Cargo9-Nov-06 23:37
Inactive Cargo9-Nov-06 23:37 
AnswerRe: COM Inheritance Pin
prasad_som10-Nov-06 1:13
prasad_som10-Nov-06 1:13 
QuestionUsing COM crreated by MatLab Pin
Dhanushka P9-Nov-06 1:04
Dhanushka P9-Nov-06 1:04 
QuestionInstalling Certificates in IE Pin
Subrahmanyam K9-Nov-06 0:43
Subrahmanyam K9-Nov-06 0:43 
Questionadding dll in C#? Pin
barak1604879-Nov-06 0:02
barak1604879-Nov-06 0: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.