P/Invoke Problem....

  • Thread starter Thread starter Tom J
  • Start date Start date
T

Tom J

Why does the following cause an EntryPointNotFoundException when I do
ExitWindows(0,0); ?
[DllImport("user32.dll", CharSet=CharSet.Auto)]

static extern bool ExitWindows(ulong dwReserved, uint uReserved);

<<<<<<<<<<<<<<<<<<
 
A guess:

"bool" is not the same thing as WIN32 "BOOL". Try
declaring the function as returning an int32...

--Richard
-----Original Message-----
Why does the following cause an
EntryPointNotFoundException when I do
ExitWindows(0,0); ?
[DllImport("user32.dll", CharSet=CharSet.Auto)]

static extern bool ExitWindows(ulong dwReserved, uint uReserved);

<<<<<<<<<<<<<<<<<<




.
 
Tom,
Why does the following cause an EntryPointNotFoundException when I do
ExitWindows(0,0); ?

Because there's no Win32 function called ExitWindows - it's just a
macro defined to call ExitWindowsEx. From Winuser.h:

#define ExitWindows(dwReserved, Code) ExitWindowsEx(EWX_LOGOFF,
0xFFFFFFFF)



Mattias
 
Yes, I finally just ended up setting the EntryPoint to ExitWindowsEx and all
was ok.

Sure do wish the sdk documentation would differentiate between macros and
actual functions so that I didn't have to go look at the headers all the
time.

Thanks for the help!
 
Back
Top