Page 1 of 1 1
Topic Options
#120311 - 2004-05-28 12:34 AM Is there a way to get the thread or hwnd from ...
pearly Offline
Getting the hang of it
*****

Registered: 2004-02-04
Posts: 92
Is there a way to get the thread or hwnd from a process id?

Thanks!~

Top
#120312 - 2004-05-28 01:12 AM Re: Is there a way to get the thread or hwnd from ...
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You may be able to get the information you desire via WMI. checkout the following link.

Win32_Thread WMI class represents a thread of execution
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#120313 - 2004-06-02 07:32 PM Re: Is there a way to get the thread or hwnd from ...
pearly Offline
Getting the hang of it
*****

Registered: 2004-02-04
Posts: 92
How do you use this WMI in KiXtart? I'm somewhat confused with the curly braces. Is there some sort of documentation in the KiXtart forums? I've searched to no end.

I saw something like this (EnumProcess)

Code:
Function EnumProcess($exe, optional $terminate, optional $Computer)
Dim $winmgmts, $ExecQuery, $Process, $id
Dim $GetObject
If NOT $computer $computer=@wksta EndIf
$winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER"
Select
Case Val($exe)>0
$ExecQuery="select * from Win32_Process where ProcessId='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Process in $GetObject
If $terminate $=$Process.Terminate EndIf
$EnumProcess = $Process.name
Next
$GetObject=''
Case VarType($exe)=8
$ExecQuery="select * from Win32_Process where Name='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Process in $GetObject
If $terminate $=$Process.Terminate EndIf
$id=$Process.ProcessId
$EnumProcess = "$Id" + "|" + "$EnumProcess"
Next
$EnumProcess=Left($EnumProcess,Len($EnumProcess)-1)
$GetObject=''
Case 1
Exit 1
EndSelect
EndFunction



Any help is appreciated!

Top
#120314 - 2004-06-06 08:45 PM Re: Is there a way to get the thread or hwnd from ...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
WMI is well documented on MSDN (Microsoft Developer Network) and the Microsoft WMI SDK.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 931 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.069 seconds in which 0.03 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org