Get the handle of QQ.exe from the process

xiaoxiao2021-03-06  104

Transfer from http://blog.9cbs.net/cso/archive/2004/08/15/75350.aspx

The function is defined, I didn't add it, I found it!

DIM USNAPSHOT AS Long 'System Snapshot Return Value DIM URESULT AS LONG' Traverse Process Return Value DIM UPROCESS AS Processentry32 'Defining Procedure Structure Variable DIM Mehandle As long' process handle

USNAPSHOT = CreateToolHelp32Snapshot (TH32CS_SNAPPROCESS, 0 &) Establishing System Snapshot Uprocess.dwsize = LEN (UPRocess) 'Initialization Process Information Length

If usnapshot kilirst (usnapshot, uprocess) 'get the first process Do WHILT IRESULT IF INSTR (Uprocess.szexefile, INSTR (Uprocess.Szeefile, Chr (0)) - 1), "QQ.EXE") > 0 Then meHandle = OpenProcess (PROCESS_ALL_ACCESS, True, uProcess.th32ProcessID) 'meHandle in what you want QQ handle End If uResult = Process32Next (uSnapShot, uProcess)' get the next snapshot of a process loopEnd If

转载请注明原文地址:https://www.9cbs.com/read-126912.html

New Post(0)