SuperStrict Const TH32CS_SNAPPROCESS:Int = 2 Type PROCESSENTRY32 Field dwSize:Int Field cntUsage:Int Field th32ProcessID:Int Field th32DefaultHeapID:Int Field th32ModuleID:Int Field cntThreads:Int Field th32ParentProcessID:Int Field pcPriClassBase:Int Field dwFlags:Int Field szExeFile:Byte,b1:Byte,b2:Byte,b3:Byte '4 + 256=260 bytes for path Field p0:Long,p1:Long,p2:Long,p3:Long Field p4:Long,p5:Long,p6:Long,p7:Long Field p8:Long,p9:Long,pa:Long,pb:Long Field pc:Long,pd:Long,pe:Long,pf:Long Field q0:Long,q1:Long,q2:Long,q3:Long Field q4:Long,q5:Long,q6:Long,q7:Long Field q8:Long,q9:Long,qa:Long,qb:Long Field qc:Long,qd:Long,qe:Long,qf:Long Field th32MemoryBase:Int Field th32AccessKey:Int End Type Extern "Win32" Function WinExec(lpCmdLine:Byte Ptr,nCmdShow:Int) Function CreateToolhelp32Snapshot:Int(lFlags:Int, lProcessID:Int) Function Process32First(hSnapShot:Int, uProcess:Byte Ptr) Function Process32Next(hSnapShot:Int, uProcess:Byte Ptr) Function CloseHandle(hPass:Int) End Extern Local p:PROCESSENTRY32=New PROCESSENTRY32 p.dwSize=SizeOf(processentry32) Local h:Int=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0) process32First(h,p) DebugLog "szExeFile="+String.FromCString(Varptr p.szExeFile) While process32Next(h,p) DebugLog " szExeFile="+String.FromCString(Varptr p.szExeFile) Wend
Note the need to declare the arguments in extern functions as type byte ptr to correctly pass the bmx object as a struct.