Well, here's some code to get the list of running process IDs, but there's a slight 'issue' in that I seem to be missing something with the process name (it says 'illegal type conversion'). I think the Process32First/Next functions are overwriting something and it's too late to fiddle too much with it! I briefly tried banks but they end up causing a 'not a valid bank handle' error).
You should find the process in this list IDs match those in Task Manager, at least!
(As you can see James, it's pretty damned trivial of a job ;) )
Yeah, I really meant the time it takes to look up the functions from MSDN, etc, and create the .decls, etc, and I just didn't have the time!
You should find the process in this list IDs match those in Task Manager, at least!
; ----------------------------------------------------------------------------- ; Create or open existing kernel32.decls file in userlibs folder and place ; these lines in it (uncommented!)... ; ----------------------------------------------------------------------------- ; ; .lib "kernel32.dll" ; ; CreateToolhelp32Snapshot% (flags, th32processid) ; Process32First% (snapshot, entry*) ; Process32Next% (snapshot, entry*) ; CloseHandle% (object) ; ; ----------------------------------------------------------------------------- Const MAX_PATH = 264 Const TH32CS_SNAPHEAPLIST = $1 Const TH32CS_SNAPPROCESS = $2 Const TH32CS_SNAPTHREAD = $4 Const TH32CS_SNAPMODULE = $8 Const TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE Const TH32CS_INHERIT = $80000000 Const INVALID_HANDLE_VALUE = -1 Const SizeOf_PE32 = 296 Type PROCESSENTRY32 Field dwSize Field cntUsage Field th32ProcessID Field th32DefaultHeapID Field th32ModuleID Field cntThreads Field th32ParentProcessID Field pcPriClassBase Field dwFlags Field szExeFile$ [MAX_PATH] End Type snap = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0) If snap Proc32.PROCESSENTRY32 = New PROCESSENTRY32 Proc32\dwSize = SizeOf_PE32 If Process32First (snap, Proc32) Print "Process ID: " + Proc32\th32ProcessID While Process32Next (snap, Proc32) Print "Process ID: " + Proc32\th32ProcessID Print "----> Parent process ID: " + Proc32\th32ParentProcessID ;Print Proc32\szExeFile ; Illegal type conversion? Wend EndIf CloseHandle (snap) EndIf Print "Hit ENTER..." Input () End
(As you can see James, it's pretty damned trivial of a job ;) )
Yeah, I really meant the time it takes to look up the functions from MSDN, etc, and create the .decls, etc, and I just didn't have the time!