With the help of ChatGPT, I get this. But, I got an error on line 3: Illegal SUB/FUNCTION parameter. Help...
Code: (Select All)
DECLARE DYNAMIC LIBRARY "kernel32"
FUNCTION CreateToolhelp32Snapshot% (BYVAL dwFlags AS _UNSIGNED LONG, BYVAL th32ProcessID AS _UNSIGNED LONG)
FUNCTION Process32First% (BYVAL hSnapshot AS _UNSIGNED LONG, lppe AS ANY) '*** Error in this line
FUNCTION Process32Next% (BYVAL hSnapshot AS _UNSIGNED LONG, lppe AS ANY)
FUNCTION CloseHandle% (BYVAL hObject AS _UNSIGNED LONG)
END DECLARE
TYPE PROCESSENTRY32
dwSize AS LONG
cntUsage AS LONG
th32ProcessID AS LONG
th32DefaultHeapID AS LONG
th32ModuleID AS LONG
cntThreads AS LONG
th32ParentProcessID AS LONG
pcPriClassBase AS LONG
dwFlags AS LONG
szExeFile AS STRING * 260
END TYPE
FUNCTION GetProcessList$ ()
DIM processSnapshot AS _UNSIGNED LONG
DIM processEntry AS PROCESSENTRY32
DIM processList AS STRING
processEntry.dwSize = LEN(processEntry)
' Maak een snapshot van alle draaiende processen
processSnapshot = CreateToolhelp32Snapshot(2, 0)
IF processSnapshot = -1 THEN
GetProcessList$ = "Fout bij het maken van snapshot."
EXIT FUNCTION
END IF
' Verkrijg het eerste proces
IF Process32First(processSnapshot, processEntry) = 0 THEN
GetProcessList$ = "Geen draaiende processen gevonden."
EXIT FUNCTION
END IF
' Voeg elk proces toe aan de lijst
DO
processList = processList + LEFT$(processEntry.szExeFile, INSTR(processEntry.szExeFile, CHR$(0)) - 1) + _NEWLINE$
LOOP UNTIL Process32Next(processSnapshot, processEntry) = 0
' Sluit het snapshot
CloseHandle processSnapshot
GetProcessList$ = processList
END FUNCTION
PRINT GetProcessList$