次の方法で共有


'Introducing' PINVOKE.NET and its Visual Studio Add-In!

I guess I'm not cut out to be a journalist.

Two weeks ago when I decided to spend my weekend creating the PINVOKE.NET wiki, I had a great opportunity to awaken my blog from its deep slumber by announcing it to the world. But Ben, Brad, Brian, Charlie, Chris, Corrado, Darth, Duncan, Ivan, James, Jesse, Jim, Joe, Josh, Julia, Ken, Peter, Phil, Sam, Sean, Shawn, Ted, Yorai, and numerous other people beat me to it!

This past weekend I put the finishing touches on a Visual Studio add-in that communicates with PINVOKE.NET via a Web service and uploaded it to gotdotnet.com. As I waited for it to appear, I knew that this was my second chance to have an exclusive scoop on my blog. Lo and behold, Kevin, Kent, Josh, Girish, and Paul let the cat out of the bag before I did!

Don't get me wrong… I'm flattered that so many people find this stuff blog-worthy! Ever since preparing for PDC 2003 last September, I wanted to create such a site in order to help people with the PInvoke problem. That's when I reserved the pinvoke.net domain name. But it wasn't until an e-mail discussion on Thursday 4/15 about the difficulty of PInvoke that I put my foot down and was determined to get the site up and running by that Monday morning (4/19)! That's also when it dawned on me that the wiki approach was the way to make this happen fast. I'm grateful that I stumbled across the great work the FlexWiki folks have done.

So thank you for all of your great comments on the site, in e-mail, and in your blogs. It gives me hope that the site is starting to achieve its objective. And thank you especially for your contributions to the wiki! As a community we've expanded the site from 6 to 25 DLLs, with approximately 1,700 signatures & types, including hundreds of pages with sample code, alternative managed APIs, VB signatures, and other helpful information. All this in just two and a half weeks! I want to highlight Craig Ellis in particular, who contributed 54 functions and 8 structures all in one sitting!

Therefore, I'm not going to introduce the site. If you're somehow reading my blog but aren't familiar with it, please visit https://www.pinvoke.net for more information. And don't worry, support for more browsers is still on my TODO list. (Working on the site is reserved for my sparest of spare time!)

I do want to give a quick overview of what the Visual Studio add-in does, however. After installing it from here, you'll get two new menu items when right-clicking in source code:

The Insert PInvoke Signatures… option opens a dialog, shown here with the results for the MessageBeep API:

Once you type in a function name and press Enter, you can get a description, PInvoke signature(s), and an alternative managed API from the PINVOKE.NET web service. If you want more information (such as sample code or structure definitions), you can click on the link at the bottom.

But 'tis better to give than to receive, right? If you want an easy way to contribute to the PINVOKE.NET project, highlight some code and select the Contribute PInvoke Signatures and Types… option:

You'll get the following dialog, which enables you to upload your content:

Let me know if you have any questions/comments, and enjoy!

Comments

  • Anonymous
    May 06, 2004
    I think the perfect next step would be an option to paste in the code snippets into the editor as well if they exist. Optionally I could also see people wanting to include the pinvoke.net or MSDN help URL above the signature/sample code as a comment. This is really cool stuff though.
  • Anonymous
    May 06, 2004
    Hey man, I think I had the original scoop on this one. ;) Sorry, didn't mean to burst your bubble. Awesome, awesome stuff, and badly needed.
  • Anonymous
    May 06, 2004
    Ah, I missed that, so I've added your name above. :) Sorry about spoiling your contest idea!
  • Anonymous
    May 06, 2004
    You probably did me a favor. I didn't have the web service to work with that your add-in has, so it was getting ugly anyway. I'm sure I can come up with another idea or two for add-ins. ;)
  • Anonymous
    May 07, 2004
    Great tool, I wish I had it years ago. I've a couple of observations and questions ...

    I browsed around looking at some of the APIs I have used and already spotted a few differences. Many are of the type where I used an int instead of a uint - small but perhaps significant - so it has already proved useful.

    Also, I noticed that the signatures I looked at did not decorate the methods with attributes, such as SetLastError = true etc. Do any of them? Should these be there?

    Is there a means of reporting differences, or starting a discussion about what the most appropriate signature should be? Should I just upload the signature I use and let someone (you?) sort it out?

    It would be nice if there was a downloadable database so offline developement could use this tool.

  • Anonymous
    May 08, 2004
    Thanks, David. Yes, there can be many ways to define a PInvoke signature, and they can be equally correct. For example:

    - Maybe you want to set PreserveSig=false in order to get exceptions instead of raw failure HRESULTs
    - Maybe you want to use SuppressUnmanagedCodeSecurity because you've ruled out the possibility of a luring attack
    - Maybe you can define the parameters differently because you're using the API in a limited scenario

    The idea is that people should feel free to add additional versions of a signature, with a note explaining why. For an example, see http://pinvoke.net/jump.aspx/kernel32.GetVersionEx. Or if you know that an existing signature is just wrong, feel free to correct it. Or if you aren't sure, feel free to start a discussion on that function's page, and hopefully someone will come along with an answer.

    In the case of SetLastError=true, I'd say it should be marked for all APIs that use that mechanism, although it turns out that the CLR exhibits SetLastError=true behavior for many Win32 DLLs anyway, regardless of how the signatures are marked. It's also interesting to note that the VB compiler always emits SetLastError=true when you use a Declare statement. So I'm now thinking that I should change the template to stick SetLastError=true in C# signatures by default.
  • Anonymous
    May 09, 2004
    Do you have a web service running, that we could say, hook
    up from a client to retrieve this information?

    Miguel
  • Anonymous
    May 09, 2004
    Yes, check out http://www.pinvoke.net/pinvokeservice.asmx.
  • Anonymous
    May 09, 2004
    The comment has been removed
  • Anonymous
    May 10, 2004
    "Introducing" PINVOKE.NET and its Visual Studio Add-In! .NET????????WindowsAPI?????DllImport??????????????????????????????????????????????? ??????VS.NET????????????????????PINVOKE.NET??Web???????????????????????????????? ?????????????????????···...
  • Anonymous
    May 10, 2004
    So so so SO great. Ever since the first day I started doing P/Invoke I wondered why there wasn't a repository for signatures... but the VS.NET add-in is a very welcome surprise.

    Thanks, Adam, for your efforts (your book is a constant fixture on the desks of myself and my coworkers) and to everyone who has contributed signatures!
  • Anonymous
    May 10, 2004
    I have done a version that works behind proxy servers.

    Download source code OR binary from
    http://www.stripe.dsl.pipex.com/PInvokeAddin
  • Anonymous
    May 11, 2004
    I applaud Adam's creation, PINVOKE.NET, and its community driven repository of PINVOKE declarations for .NET. When I'm doing managed development and need to make some call into unmanaged territory, I'll be certain to look there first for assistance.
  • Anonymous
    May 11, 2004
    Truly awesome stuff, Adam. All I can say is that it is about time someone did something like this. Your efforts are really appreciated. Thanks!
  • Anonymous
    May 18, 2004
    Very Nice...
    I program in VB.Net but I prefer to use the <DllImport(....)> style of declare to the old VB Classic style.
    How about adding that option?
  • Anonymous
    May 18, 2004
    The comment has been removed
  • Anonymous
    May 20, 2004
    The comment has been removed
  • Anonymous
    May 22, 2004
    Would it be possible if the webservice also had a method to get a list of the modules currently available?
  • Anonymous
    May 31, 2004
    The comment has been removed
  • Anonymous
    June 03, 2004
    The comment has been removed
  • Anonymous
    June 13, 2004
    I've written a small application using Delphi 7 (Win32) that gets header declarations from PInvoke.NET and even converts them to Delphi for .NET. You can download it at <a href="http://www.agnisoft.com/downloads/pbroker.zip">http://www.agnisoft.com/downloads/pbroker.zip</a> or visit my blog page on it at <a href="http://shenoyatwork.blogspot.com/2004/06/pinvoke-and-delphi.html">http://shenoyatwork.blogspot.com/2004/06/pinvoke-and-delphi.html</a>.

    Great work, Adam, this is a really cool service!
  • Anonymous
    June 13, 2004
    uh oh, I messed up. The URLs are:
    http://www.agnisoft.com/downloads/pbroker.zip
    and
    http://shenoyatwork.blogspot.com/2004/06/pinvoke-and-delphi.html

    Sorry about that.
  • Anonymous
    June 24, 2004
    hmm ... every time I tried it the user32.dll terminated with an error . what is wrong
  • Anonymous
    July 18, 2004
    -"1,700 signatures & types" it real cool :)
  • Anonymous
    July 21, 2004
    This is great Add-in.
    However I noticed that it does not work with Visual Studio 2005 Express Edition :(
    Thank you
  • Anonymous
    July 27, 2004
    The comment has been removed
  • Anonymous
    July 27, 2004
    The comment has been removed
  • Anonymous
    May 09, 2005
    In a recent meeting, I got the opportunity to meet Ward Cunningham, David Orenstein, and Korby Parnell.&amp;nbsp;...
  • Anonymous
    November 27, 2005
    Hi,

    after installing it with my visual studio version 2005 (no beta) - the addin doesn't appear. What should I do? The setup finished without errors.
  • Anonymous
    February 09, 2006
    The comment has been removed
  • Anonymous
    March 07, 2006
    shannon_n@merelink-mono.com
  • Anonymous
    March 08, 2006
    martin2king@homtail.com
  • Anonymous
    March 08, 2006
    antony@fillaribze.com
  • Anonymous
    March 08, 2006
    Sam@opertonickers.com
  • Anonymous
    March 11, 2006
    napsfavalleyfsoft3006@yahoo.com
  • Anonymous
    March 16, 2006
    rob@uscb.com
  • Anonymous
    April 25, 2006
    8945ht5h4h@yahoo.com
  • Anonymous
    April 30, 2006
    rhys@tesis.com.com
  • Anonymous
    May 05, 2006
    The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...
  • Anonymous
    May 09, 2006
    online directory main
  • Anonymous
    May 29, 2006
    shjd@bradjewelry.org
  • Anonymous
    May 31, 2006
    johny@depp.ru
  • Anonymous
    June 02, 2006
    johnson@xdsj.com
  • Anonymous
    June 02, 2006
    johnson@cn.com
  • Anonymous
    June 06, 2006
    Thanks!!! http://www.insurance-top.com/company/">http://www.insurance-top.com/company/ auto site insurance. [URL=http://www.insurance-top.com]home insurance[/URL]: compare car insurance, auto insurance, insurance car. Also [url=http://www.insurance-top.com]cars insurance[/url] from website .
  • Anonymous
    June 06, 2006
    Hi! http://www.insurance-top.com/company/ auto site insurance. compare car insurance, auto insurance, insurance car. from website .
  • Anonymous
    June 09, 2006
    stafanymalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafanymalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 09, 2006
    stafadnymdalfoy@yahoo.co.tv
  • Anonymous
    June 13, 2006
    Hoodia gordonii diet pills.
    http://beam.to/cellulitesolution/
    http://beam.to/hoodiapills/
    http://beam.to/hoodiagordonii/
    http://beam.to/h57hoodia/
    <a href=http://beam.to/hoodiapills/>hoodia diet pills</a>
    <a href=http://beam.to/hoodiagordonii/>hoodia gordonii</a>
    <a href=http://beam.to/h57hoodia/>h57hoodia</a>
    cheap pharmacy hoodia cactus extract kill appetite pills.
  • Anonymous
    June 15, 2006
    Hoodia gordonii diet pills.
    http://beam.to/cellulitesolution/
    http://beam.to/hoodiapills/
    http://beam.to/hoodiagordonii/
    http://beam.to/h57hoodia/
    <a href=http://beam.to/hoodiapills/>hoodia diet pills</a>
    <a href=http://beam.to/hoodiagordonii/>hoodia gordonii</a>
    <a href=http://beam.to/h57hoodia/>h57hoodia</a>
    cheap pharmacy hoodia cactus extract kill appetite pills.
  • Anonymous
    June 20, 2006
    Persone los pioneros non rabata. Great...
  • Anonymous
    June 23, 2006
    Best of all people w can talk...
  • Anonymous
    August 09, 2006
    Text: cbc3fac2dc74c4adab698148eeeed9020
    <a href="cbc3fac2dc74c4adab698148eeeed90200">cbc3fac2dc74c4adab698148eeeed90200</a>
    [a]cbc3fac2dc74c4adab698148eeeed90201[/a]
    [a href=cbc3fac2dc74c4adab698148eeeed90202]cbc3fac2dc74c4adab698148eeeed90202[/a]
    [a href="cbc3fac2dc74c4adab698148eeeed90203"]cbc3fac2dc74c4adab698148eeeed90203[/a]
    [link]cbc3fac2dc74c4adab698148eeeed90204[/link]
    [link=cbc3fac2dc74c4adab698148eeeed90205]cbc3fac2dc74c4adab698148eeeed90205[/link]
    [link="cbc3fac2dc74c4adab698148eeeed90206"]cbc3fac2dc74c4adab698148eeeed90206[/link]
    [url]cbc3fac2dc74c4adab698148eeeed90207[/url]
    [url=cbc3fac2dc74c4adab698148eeeed90208]cbc3fac2dc74c4adab698148eeeed90208[/url]
    [url="cbc3fac2dc74c4adab698148eeeed90209"]cbc3fac2dc74c4adab698148eeeed90209[/url]
  • Anonymous
    August 14, 2006
    buytextlink@links-universe.info
  • Anonymous
    August 20, 2007
    The comment has been removed
  • Anonymous
    January 24, 2008
    PingBack from http://softwareinformation.247blogging.info/powertoys-weblog-get-pinvokenet-native-method-signatures-directly/
  • Anonymous
    July 30, 2008
    No prescription didrex. Didrex. Cheap didrex without prescription.