
240
|
Chapter 7, Help and Research
#62 Use P/Invoke with Ease
HACK
Using PInvoke.NET
PInvoke.NET is a wiki that acts as a reference for P/Invoke signatures and
unmanaged APIs.
A wiki is a web site that can easily be edited by anyone using
the web site—and I mean anyone. This allows a large num-
ber of people to pool their knowledge and research in a sin-
gle location. For more information about wikis, please refer
to the original wiki at: http://c2.com/cgi/wiki?WikiWikiWeb.
Using PInvoke.NET, you can look for, and usually find, the P/Invoke signa-
ture call that you are looking for. The PInvoke.NET main screen is shown in
Figure 7-14.
As an example, let’s look for the signature for the
FindWindow API.
If you knew that
FindWindow was located in user32.dll, you could browse
using the tree on the left of the screen. Or you could simply enter the term
FindWindow in the Search box and the first result would be the page shown in
Figure 7-15.
This page contains a number of details about the
FindWindow API. The first
item on the page is the C# signature needed to call this API from C#. The
Figure 7-14. PInvoke.NET