The MDA appears on the call to OpenDesktop.
I have tried a variety of approaches (including specifying the A and W
variant with ExactSpelling=t rue, and PreserveSig=tru e) but none of them seem
to work. This code was copied from a 1.1 sample that purported to work
without an error.
public static class Desktop
{
private const long DESKTOP_SWITCHD ESKTOP = 0x0100L;
[DllImport("user 32.dll", CharSet=CharSet .Auto, PreserveSig=tru e)]
private static extern IntPtr OpenDesktop(str ing lpszDesktop, int
dwFlags, bool fInherit, long dwDesiredAccess );
[DllImport("user 32.dll")]
private static extern bool SwitchDesktop(I ntPtr hDesktop);
public static bool IsLocked()
{
IntPtr hdt = OpenDesktop("De fault", 0, false,
DESKTOP_SWITCHD ESKTOP);
if (IntPtr.Zero == hdt)
return false;
return SwitchDesktop(h dt);
}
}