Contact

admin

About Me · Send mail to the author(s) E-mail · Twitter

At GROSSWEBER we practice what we preach. We offer trainings for modern software technologies like Behavior Driven Development, Clean Code and Git. Our staff is fluent in a variety of languages, including English.

Feed Icon

Tags

Open Source Projects

Archives

Blogs of friends

Now playing [?]

Error retrieving information from external service.
Audioscrobbler/Last.fm

ClustrMap

pinvoke.net Add-In for Visual Studio 2005

Posted in Tools and Software | Visual Studio at Monday, July 24, 2006 6:38 PM W. Europe Daylight Time

pinvoke.net LogoThe .NET Framework 2.0 has become pretty comprehensive compared to version 1.1. For example, Microsoft added features for ACLs in .NET 2.0. However, in some cases us developers need a function not directly supported by the framework but by the underlying (Windows) operating system. Platform Invoke, or P/Invoke for short, is a way to call Windows functions from .NET code. First you'll have to declare the function by finding out which DLL contains the function and the type of return value and parameters. When you have to do this more than twice a day, this can become nerve-racking.

We live in a world of social software and Adam Nathan had the great idea of creating the pinvoke.net Wiki for the reason that nobody should be bothered with the tasks browsing MSDN for finding the correct DLL and translate the built-in Windows types to their .NET representation ...well, except the first one that uses a platform function :-) The Wiki is a great resource for P/Invoke declarations for a wide variety of libraries and everyone is invited to post his own.

To make the Wiki even more useful, Adam Nathan developed the pinvoke.net Add-In for Visual Studio .NET 2003. I like it a lot and wondered why it hasn't been ported to Visual Studio 2005 for a long time. Bernhard Elbl finally created a version for Visual Studio 2005 in May, and yesterday I fortunately stumbled across it!

However, I had a hard time installing it because I run an English version of Visual Studio 2005 on a German Windows XP. Visual Studio searches for Add-Ins in pre-defined folders that are not localized to the OS language. You find these paths under Tools/Options/Environment/Add-In/Macros Security in Visual Studio 2005.

Visual Studio Add-In Options

As you see the first entry reads

%ALLUSERSPROFILE%\Application Data\Microsoft\MSEnvShared\Addins

On a German machine this should rather be

%ALLUSERSPROFILE%\Anwendungsdaten\Microsoft\MSEnvShared\Addins

You can either add a path containing your localized version of "Application Data" or move the pinvoke.net.AddIn file to a folder that is contained in the search folder list.

Happy P/Invoking!

Now playing: Madonna - Confessions on a dance floor - Jump

All comments require the approval of the site owner before being displayed.
(will show your gravatar icon)
 
[Captcha]Enter the code shown (prevents robots):

Live Comment Preview