P/Invoke Problem....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom J

    P/Invoke Problem....

    Why does the following cause an EntryPointNotFo undException when I do
    ExitWindows(0,0 ); ?
    [color=blue][color=green][color=darkred]
    >>>>>>>>>>>>> >[/color][/color][/color]
    [DllImport("user 32.dll", CharSet=CharSet .Auto)]

    static extern bool ExitWindows(ulo ng dwReserved, uint uReserved);

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




  • Richard

    #2
    P/Invoke Problem....

    A guess:

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

    --Richard
    [color=blue]
    >-----Original Message-----
    >Why does the following cause an[/color]
    EntryPointNotFo undException when I do[color=blue]
    >ExitWindows(0, 0); ?
    >[color=green][color=darkred]
    >>>>>>>>>>>>> >>[/color][/color]
    >[DllImport("user 32.dll", CharSet=CharSet .Auto)]
    >
    >static extern bool ExitWindows(ulo ng dwReserved, uint[/color]
    uReserved);[color=blue]
    >
    ><<<<<<<<<<<<<< <<<<
    >
    >
    >
    >
    >.
    >[/color]

    Comment

    • Mattias Sjögren

      #3
      Re: P/Invoke Problem....

      Tom,
      [color=blue]
      >Why does the following cause an EntryPointNotFo undException when I do
      >ExitWindows(0, 0); ?[/color]

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

      #define ExitWindows(dwR eserved, Code) ExitWindowsEx(E WX_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.

      Comment

      • Tom J

        #4
        Re: P/Invoke Problem....

        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" <mattias.dont.w ant.spam@mvps.o rg> wrote in message
        news:%23pRBLU16 DHA.2656@TK2MSF TNGP11.phx.gbl. ..[color=blue]
        > Tom,
        >[color=green]
        > >Why does the following cause an EntryPointNotFo undException when I do
        > >ExitWindows(0, 0); ?[/color]
        >
        > Because there's no Win32 function called ExitWindows - it's just a
        > macro defined to call ExitWindowsEx. From Winuser.h:
        >
        > #define ExitWindows(dwR eserved, Code) ExitWindowsEx(E WX_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.[/color]


        Comment

        Working...