By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,459 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,459 IT Pros & Developers. It's quick & easy.

P/Invoke Problem....

P: n/a
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);

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


Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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 doExitWindows(0,0); ?
>>>>>>>>>>>
[DllImport("user32.dll", CharSet=CharSet.Auto)]

static extern bool ExitWindows(ulong dwReserved, uint

uReserved);
<<<<<<<<<<<<<<<<<<


.

Nov 15 '05 #2

P: n/a
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #3

P: n/a
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!
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.