
Code: Alles auswählen
Procedure SearchProcess(Name.s)
Protected result.l, Snapshot.l, ProcessFound.l, PN$, Process.PROCESSENTRY32
Process\dwSize = SizeOf(PROCESSENTRY32)
Snapshot = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS, 0)
If Snapshot
ProcessFound = Process32First_(Snapshot, Process)
While ProcessFound
PN$ = UCase(PeekS(@Process\szExeFile, #PB_Any, #PB_Ascii))
If UCase(Name) = GetFilePart(PN$) : result = #True : Break : EndIf
ProcessFound = Process32Next_(Snapshot, Process)
Wend
CloseHandle_(Snapshot)
EndIf
ProcedureReturn result
EndProcedure
If SearchProcess("PureBasic.exe")
Debug "Programm läuft"
Else
Debug "Nicht gefunden"
EndIf
Nachtrag:
Unterstützt jetzt auch Unicode!