Easy ways to use Win32 and other unmanaged APIs from .NET

From Yggenyk
Revision as of 06:33, 28 August 2008 by WikiSysop (talk | contribs) (→‎PInvoke Visual Studio Add-in)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<google>ENGELSK</google>

PInvoke Visual Studio Add-in

PInvoke is an add-in for Visual Studio that allows you to add an interop by opening the add-in and search for the unmanages API or Type you want to use.

PInvoke gets the information from an online Wiki http://pinvoke.net/ where also can find the interop's.

To install Pinvoke.net download it here (remember to read the note about Pinvoke.net and Visual Studio 2008 below):

You will get it together with a free trial ANTS Profiler and Exception Hunter, but you can choose not to install them.

Pinvoke.net.jpg

PInvoke.net add-in support for Visual Studio 2008

If PInvoke.NET add-in don't work with Visual Studio 2008 you will need to modify the add-in's configuration file.

On Windows Vista it is very impotent that the editor you use for modifying the configuration file is opened with "RUN AS ADMINISTARTOR". Otherwise it will not overwrite the file, but save a copy in a virtual folder.

If that happens the add-in wont show up. Before you try again you will need to delete the virtual folder: "C:\Users\<username>\AppData\Local\VirtualStore\Program Files\Red Gate\PInvoke.net", otherwise your editor will keep opening the file from here instead of the one in C:\Program Files\....

First, locate the PInvokeDotNetAddIn.Addin file located in %programfiles%\red gate\PInvoke.NET, open it with a text editor such as notepad.exe, and make the following changes:

After the text:

<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>8.0</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>8.0</Version>
</HostApplication>

Add:

<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>9.0</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>9.0</Version>
</HostApplication>

and save the file.

It may also be necessary to add the path to the PInvoke add-in to the list of folders where Visual Studio will look for add-ins. From Visual Studio 2008's Tools menu, select Options, then Add-in/Macro security. If the path to the PInvoke.NET installation folder (c:\program files\red gate\PInvoke.NET) is not listed in the collection of add-in file paths, click the add button and select the installation folder.

After restarting Visual Studio 2008, the add-in will function as it does in previous versions of Visual Studio.


<google>ENGELSK</google>

id=siteTree