Ver Mensaje Individual
  #3
Antiguo 5 de noviembre de 2024, 22:46
Kuk
Administrador
Última Actividad 21.09.2026 18:24
Posts Posts: 2.500
Likes enviados Enviados: 1037
Likes recibidos Recibidos: 1207

@Joseg,

Código COBOL:
  1.  ENVIRONMENT     DIVISION.
  2.  DATA            DIVISION.
  3.  WORKING-STORAGE SECTION.
  4.  01  DWORD       typedef pic s9(9) comp-5.
  5.  01  ULONG_PTR   typedef pic  9(9) comp-5.
  6.  01  LONG        typedef pic s9(9) comp-5.
  7.  01  HANDLE      typedef pic s9(9) comp-5.
  8.  
  9. *>---------------------------------------------
  10.  01  TH32CS_SNAPPROCESS      type DWORD value h"02".
  11. *>---------------------------------------------
  12.  
  13.  01  PROCESSENTRY32.
  14.      05  dwSize              type DWORD.
  15.      05  cntUsage            type DWORD.
  16.      05  th32ProcessID       type DWORD.
  17.      05  th32DefaultHeapID        pointer.
  18.      05  th32ModuleID        type DWORD.
  19.      05  cntThreads          type DWORD.
  20.      05  th32ParentProcessID type DWORD.
  21.      05  pcPriClassBase      type LONG.
  22.      05  dwFlags             type DWORD.
  23.      05  szExeFile           pic x(1000).
  24.      
  25.  01  snapshot                type HANDLE.
  26.  
  27.  01  returnCode              type DWORD.
  28.  
  29.  PROCEDURE       DIVISION.
  30.  
  31.      call "CreateToolhelp32Snapshot" with stdcall using by value TH32CS_SNAPPROCESS
  32.                                                          by value 0
  33.                                                          returning snapshot
  34.      
  35.      move length of PROCESSENTRY32 to dwSize
  36.      
  37.      call "Process32First" with stdcall using by value snapshot
  38.                                               by reference PROCESSENTRY32
  39.                                               returning returnCode
  40.      
  41.      if  returnCode = 0
  42.          call "GetLastError" with stdcall returning returnCode
  43.          
  44.          display "GetLastError: ", returnCode
  45.          
  46.          exit program
  47.      end-if
  48.      
  49.      perform until returnCode = 0
  50.          if  szExeFile(1:8) = "Main.exe" *> resto a nulos
  51.              INVOKE pow-self "DisplayMessage" USING "Bingo!" 64
  52.          end-if
  53.                  
  54.          INVOKE CmList1 "AddString" USING szExeFile
  55.          
  56.          call "Process32Next" with stdcall using by value snapshot
  57.                                                  by reference PROCESSENTRY32
  58.                                                  returning returnCode
  59.      end-perform



NORMAS DEL FORO - para garantizar el buen funcionamiento del Foro.
¿Te han ayudado? NO TE OLVIDES de darle a
¿Quieres dirigirte a alguien en tu post? Notifícale haciendo clic en su Nick
Kuk is offline   Responder Con Cita