Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tasklist
#9
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$
Reply


Messages In This Thread
Tasklist - by BDS107 - 08-08-2024, 01:59 PM
RE: Tasklist - by SpriggsySpriggs - 08-08-2024, 02:08 PM
RE: Tasklist - by Steffan-68 - 08-08-2024, 04:07 PM
RE: Tasklist - by SMcNeill - 08-08-2024, 02:34 PM
RE: Tasklist - by Pete - 08-08-2024, 03:31 PM
RE: Tasklist - by Pete - 08-08-2024, 04:13 PM
RE: Tasklist - by DSMan195276 - 08-08-2024, 04:17 PM
RE: Tasklist - by BDS107 - 08-09-2024, 09:57 AM
RE: Tasklist - by BDS107 - 08-09-2024, 08:53 PM
RE: Tasklist - by TerryRitchie - 08-09-2024, 09:44 PM
RE: Tasklist - by SMcNeill - 08-10-2024, 03:06 AM
RE: Tasklist - by Pete - 08-10-2024, 03:23 AM



Users browsing this thread: 2 Guest(s)