Tim,
GetNextWindow isn't actually an API function, but rather, a macro that
just calls GetWindow. So you should define GetWindow, and call that. If
you really want to call a method named GetNextWindow, then you can define
the entry point, like this:
[DllImport("user32.dll", CharSet=CharSet.Auto, EntryPoint="GetWindow",
SetLastError=true)]
public static extern IntPtr GetNextWindow(
IntPtr hwnd,
[MarshalAs(UnmanagedType.U4)] int wFlag);
I changed the wFlag parameter because it would end up failing on 64-bit
systems.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Tim Mulholland" <Ti***********@nospamaddress.com> wrote in message
news:e8**************@TK2MSFTNGP14.phx.gbl...
I'm trying to call the GetNextWindow API function via C#.
I've tried two different definitions for it (both are similar), but i
always
get the same error:
An unhandled exception of type 'System.EntryPointNotFoundException'
occurred
in MsgTestCSharp.exe
Additional information: Unable to find an entry point named GetNextWindow
in
DLL user32.dll.
The most recent way i tried was:
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr GetNextWindow(IntPtr hwnd, IntPtr wFlag);
what am i doing wrong here?
Thanks in advance,
-Tim