# taskkill windowtitle win32 property



## tsgun12345 (Sep 1, 2010)

The program taskkill lets you terminate a task using its "windowtitle". What is the WIN32 process property that corresponds to "windowtitle" ? - in case you want to write your own code and not use taskkill?


----------



## TheOutcaste (Aug 8, 2007)

Welcome to TSG!

GetWindowText Function perhaps?


----------



## tsgun12345 (Sep 1, 2010)

Evidently taskkill does some sort of multi step process. I was thinking in terms of the vb script below:

See this line: msgbox "... terminating " & objProcess.Name

I was thinking there was a property like objprocess.windowtitle or objprocess.title or...?
but evidently taskkill matches the window title to the parentprocessid or who knows?
If you look at the Win32_Process Class properties - there is no windowtitle or anything similar.
Thanks.
'Terminate all processes involving the name <strProcessToKill>Option ExplicitDim strComputer, strProcessToKill, objWMIService, colProcess, objProcess strComputer = "."strProcessToKill = "notepad.exe"Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer _ & "\root\cimv2") Set colProcess = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")For Each objProcess in colProcess msgbox "... terminating " & objProcess.Name objProcess.Terminate()Next


----------



## TheOutcaste (Aug 8, 2007)

If you have MS Word installed, it can be used to get window titles. Or you can use the free JSSys3 components.
MS-Word
http://allfaq.org/forums/t/130888.aspx
JSSys3
http://www.robvanderwoude.com/vbstech_proc_process.php

You'd think there would be an easier way, but that's all I was able to find.


----------

