@Joseg,
Código COBOL:
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 DWORD typedef pic s9(9) comp-5.
01 ULONG_PTR typedef pic 9(9) comp-5.
01 LONG typedef pic s9(9) comp-5.
01 HANDLE typedef pic s9(9) comp-5.
*>---------------------------------------------
01 TH32CS_SNAPPROCESS type DWORD value h"02".
*>---------------------------------------------
01 PROCESSENTRY32.
05 dwSize type DWORD.
05 cntUsage type DWORD.
05 th32ProcessID type DWORD.
05 th32DefaultHeapID pointer.
05 th32ModuleID type DWORD.
05 cntThreads type DWORD.
05 th32ParentProcessID type DWORD.
05 pcPriClassBase type LONG.
05 dwFlags type DWORD.
05 szExeFile pic x(1000).
01 snapshot type HANDLE.
01 returnCode type DWORD.
PROCEDURE DIVISION.
call "CreateToolhelp32Snapshot" with stdcall using by value TH32CS_SNAPPROCESS
by value 0
returning snapshot
move length of PROCESSENTRY32 to dwSize
call "Process32First" with stdcall using by value snapshot
by reference PROCESSENTRY32
returning returnCode
if returnCode = 0
call "GetLastError" with stdcall returning returnCode
display "GetLastError: ", returnCode
exit program
end-if
perform until returnCode = 0
if szExeFile(1:8) = "Main.exe" *> resto a nulos
INVOKE pow-self "DisplayMessage" USING "Bingo!" 64
end-if
INVOKE CmList1 "AddString" USING szExeFile
call "Process32Next" with stdcall using by value snapshot
by reference PROCESSENTRY32
returning returnCode
end-perform