Process32First (kernel32)
Last changed: decebal mihailescu-192.193.221.142

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern bool Process32First(IntPtr hSnapshot, ref PROCESSENTRY32 lppe);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

[StructLayout(LayoutKind.Sequential)]

public struct PROCESSENTRY32

{

public uint dwSize;

public uint cntUsage;

public uint th32ProcessID;

public IntPtr th32DefaultHeapID;

public uint th32ModuleID;

public uint cntThreads;

public uint th32ParentProcessID;

public int pcPriClassBase;

public uint dwFlags;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)] public string szExeFile;

};

PROCESSENTRY32 info = new PROCESSENTRY32();

bool first = Process32First(Shot, ref info);

            if (!first) { throw(  new Exception("CANT FIRST"));};

            while(Process32Next((int)Shot, ref info) != 0)

{

// Do some with Info

};

Alternative Managed API:

Do you know one? Please contribute it!

Documentation