[StructLayout(LayoutKind.Sequential)]
internal 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;
public string szExeFile;
};
const int TH32CS_SNAPPROCESS = 2;
const int SIZEOF_PROCESSENTRY32 = 564;
const int SIZE_OFFSET = 0;
const int PROCESS_OFFSET = 8;
const int PARENT_OFFSET = 24;
private void Form1_Load(object sender, EventArgs e)
{
IntPtr hdl;
PROCESSENTRY32 p = new PROCESSENTRY32();