Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How i find a process by the name program in a list of ta
Message
De
24/03/2003 19:12:23
Fabian Belo
Independent Developer
Argentine
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00769530
Message ID:
00769535
Vues:
16
The following generates a cursor with runnig processes.
FUNCTION GetProcessList

LOCAL lnHandle, lsProcessEntry, lcCursName, lnOldArea
LOCAL lcProcessName

DECLARE INTEGER CreateToolhelp32Snapshot IN Win32Api INTEGER, INTEGER
DECLARE INTEGER Process32First IN Win32Api INTEGER, STRING @
DECLARE INTEGER Process32Next IN Win32Api INTEGER, STRING @
DECLARE INTEGER CloseHandle IN Win32Api INTEGER

lsProcessEntry = SPACE( ( 9 * 4) + 260)

lcCursName = SYS(2015)
lnOldArea = SELECT(0)
SELECT 0

CREATE CURSOR (lcCursName) (Process C( 254))

lnHandle = CreateToolhelp32Snapshot( 2, 0)
IF lnHandle > 0
lnProcess = Process32First( lnHandle, @lsProcessEntry)
DO WHILE lnProcess > 0
lcProcessName = (STRTRAN((SUBSTR(lsProcessEntry, (9*4 + 1), 254)), CHR(0)))
INSERT INTO (lcCursName) VALUES (lcProcessName)
lsProcessEntry = SPACE( ( 9 * 4) + 260)
lnProcess = Process32Next( lnHandle, @lsProcessEntry)
ENDDO
CloseHandle( lnHandle)
ELSE
*-- Some Error
ENDIF

SELECT (lnOldArea)

RETURN lcCursName
>Hi!!!
>I need find a process by name in a program of the visual fox pro 7.0, I get a list of the process Id using the external function EnumProcess, in a example of MSDN library i see that can use OpenProcess, enumprocessModules and getModuleBaseName to get a list of process, but this not work correctily, enumprocessmodules return a value equal to 0, this is the code that i use for get a list of process running in the pc.
>
>please anybody can help me!!!
"Since I've read that alcohol is bad... I quit reading."
Me


http://www.fabianbelo.com.ar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform