P / Fehler beim Aufrufen von CreateToolhelp32Snapshot in Compact Framework

Hey, ich mache eine kleine App für mein Smartphone unter Windows Mobile 6. Ich versuche, alle aktuell ausgeführten Processecs abzurufen, aber die Methode CreateToolhelp32Snapshot gibt immer -1 zurück. So, jetzt stecke ich fest. Ich habe versucht, beim Aufrufen der Methode GetLastError () einen Fehler zu erhalten, aber diese Methode gibt den Wert 0 zurück. Hier ist ein Ausschnitt aus meinem Code.

private const int TH32CS_SNAPPROCESS = 0x00000002;
[DllImport("toolhelp.dll")]
public static extern IntPtr CreateToolhelp32Snapshot(uint flags, 
                                                     uint processid);

public static Process[] GetProcesses()
    {
        ArrayList procList = new ArrayList();
        IntPtr handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

        if ((int)handle > 0)
        {
            try
            {
                PROCESSENTRY32 peCurr;
                PROCESSENTRY32 pe32 = new PROCESSENTRY32();

                // get byte array to pass to API call
                byte[] peBytes = pe32.ToByteArray();
                // get the first process
                int retval = Process32First(handle, peBytes);

Antworten auf die Frage(6)

Ihre Antwort auf die Frage