DllImport Kernel32.dll Problem with C#


  • Hello,

    I want to create a mobile 5.0 app with C# .NET. But when I use the DllImport I met some problem. My project can be build successfully. After I run it, It has a run time error! the error message is "Can't find PInvoke DLL Kernel32.dll", I can't figure out what the problem is. Below is my code

     [DllImport("KERNEL32.DLL", SetLastError = true)]
            private static extern IntPtr CreateToolhelp32Snapshot(uint dwFlags, uint th32ProcessID);

    handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);


    error happened


    Thursday, August 10, 2006 9:29 AM


  • Here is the correct P/Invoke signature:

    [DllImport("toolhelp.dll", SetLastError=true)]
    private static extern IntPtr CreateToolhelp32Snapshot(uint flags, uint processid);

    Thursday, August 10, 2006 2:45 PM

All replies