Comments (misc)
Last changed: -165.214.11.85

.
Summary
A place to leave general comments about the site.

Please note that this page has now been superseded by the Support Forum - this page has been left here for the time being to avoid losing historical comments, but all new comments should be posted here: http://www.red-gate.com/MessageBoard/viewforum.php?f=62

____________________

I can't believe this site doesn't include HID.dll!

_______

Tried to use the directory but the plus only changes to minus

Using Opera 8.52 web browser with JavaScript enabled - does

this web site require a specific browser or Java? Doesn't seem

to work at all.

I am involved in a project whereby I have to use a methods from a Win32 API (wrg303.dll). I have tried using p/invoke wizard, but it didn't gave the right answer.

The method in c++ is

BOOL _stdcall CodecStart(int hRadio,void _stdcall (CallbackFunc)(void ),void *CallbackTarget); [C# declaration]

The C/C++ declaration for second method is

DWORD __stdcall CodecRead(int hRadio, void *Buf, DWORD Size);

can u please suggest the signature that I can use in C#

                t4ure4n

The rapi.dll section needs to be corrected. Rapi is not for running on the .NET Compact Framework, but rather for desktop applications. It does not appear possible to edit this part of the page.

MikeS

Any chance on seeing some info on GetAdaptersAddresses()?

tw

I was quite excited when I found this site, but I was somewhat disappointed with the incomplete nature of some of the information. For example, I was looking for some assistance with the SHBrowseForFolder call from Shell32, and I did find it -- but it is only a tease since the definition for BROWSEINFO is not available! OK, so I had figured most of that part out myself, but I then looked for details on SHGetDesktopFolder, and the same thing is true -- there is no definition of the output of that call!

[Note from Adam: I just added 2 pages, so SHBrowseForFolder links to the BROWSEINFO structure, which links to the BrowseCallbackProc delegate used as one of its fields. The more that people can add stuff when they don't find it, we'll hopefully have fewer people feeling teased!]

I need to use this call to permit the user to browse the network neighborhood and select a specific computer system, and the .Net implementation of the wrapper for this does not seem to support the BIG_BROWSEFORCOMPUTER option! If anyone has figured this out, could they please post the information to this web site and let me know at MAILTO:kendrhyd@sympatico.ca? Thanks.

Upon seeing this I realized that a Microsoft.Win32.dll is possible. Has anyone tried 'mechancally' creating such a library? I'm sure others are thinking about it. Cut and paste is nice, but no work is better Maybe there would be Micrsoft.XP.Win32.dll, Microsoft.2000.Win32.dll as well? I'm ready to go to work, any takers?

Clint

Very cool site. Somebody needs to write game theory analysis of the developer community.

chrisbbehrens.blogspot.com

This is such a great idea -- thanks Adam

..BradA (http://blogs.msdn.microsoft.com)

Echo Brad. This is an awesome idea! Thanks Adam. I have blogged it. -- Sam Gentile (http://samgentile.com/blog/)

Great idea, thanks for creating the site. However, it does have rendering problems on Mozilla (Firefox 0.8 on Win XP to be exact). The directory tree (advapi32, gdi32 etc.) is misplaced (overlaps the "Directory" label) and I can't get them to expand.

There is also IE (6.0.2800.1106.xpsp2) bug: clicking "Edit This Page" brings up error message "A runtime error has occurred... Line: 15 Error: 'ButtonBar' is undefined". Harmless but annoying.

Krzysztof Kowalczyk (http://blog.kowalczyk.info)

The fading effect is awesome, the whole experience is extremely 'organic'. This is really the future of documentation.

This is so cool! And work with Wiki has never been more enjoyable.

Great idea, thanks for setting it up!

One question: The APIs here appear to be machanically created from some other source - from things like "System.Windows.Forms.NativeMethods"? The functions are present, but not the structures and data types used in the params. Any plans to do a mechanical dump of the structures as well? The real magic of marshalling is getting the param types set up correctly, which for structures can be quite a pain.

Things like RegisterWindowClass and GetClassInfo using the WNDCLASS structure in different ways requires creating separate structures with different field types in order to satisfy the marshaller (The WndProc pointer as a raw IntPtr in some cases, or as a method pointer in other cases). I can see that the params for GetClassInfo and RegisterWindowClass do take different structure types, but those types do not appear to be documented here.

-Danny

(http://homepages.borland.com/dthorpe/blog/delphi)

You should also check out these automatically generated PInvoke stubs which covers much of the WIn32 API

(http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=f1dd70e4-c212-4a6f-bff7-c82e34c8836f)

Cheers,

Peter Hallam

C# Compiler Dev Lead

How about a directory for the Compact Framework/coredll? - Ian Darling

This is great, but definitely needs somewhere we can define common constants and structures.

Rodney.

- Add a way to search and or highlight entries that have additional info added.

- Add a logon feature (use DotNetNuke?) to allow added posts to be tracked based on email address instead of IP address.

Charlie Kindel (http://www.kindel.com/blogs/charlie)

Some responses for the last 3 comments:

Thanks, everyone, for your participation! -- Adam Nathan

Very nice But I also miss the structures, constants, etc. Would it be possible to organize the information such as the MSDN Library does instead? I believe it will be hard to find items in for example the shell32 tree when all enums, structures, interfaces etc. are added.

I'm thinking something like this instead:

Shell

  +-----Classes
  +-----Interfaces
  +-----Functions
  +-----Callback functions
  +-----Constants, Enumerations, and Flags
  +-----Structures
  +-----(Maybe more?)

Or is it possible to do this now giving a pagename such as shell32.Structures.APPBARDATA?

-- Andreas Häber

Cheers!

Guess I'll get started soon

Ian Darling.

Dang - I think I broke kernel32.CreateFile when adding coredll.CreateFile - Ian Darling

[Note from Adam: This is now fixed, and was actually unrelated to coredll.CreateFile. Thanks!]

Thank you very much, I've been waiting for something like this for a long time now.

Mark Fernandes.

Great idea. I would also be interested in a category on PInvoke how-tos. for example I'm still trying to figure out how to unmarshal an array of delegates on the unmanaged side - feel free to chime in if you happen to know that

Alex

Great job, this helps me alot.

Could you add for avifil32.dll?

[This is done. -Adam]

Eric

Adam - cheers. Can we add aygshell.dll too (another Pocket PC one)?

[This is done. -Adam]

Maybe Pocket PC stuff should be split off into a separate namespace?

[That's a good idea. For now, I'll leave them in the same list but as it grows I'll probably separate them somehow. -Adam]

Ian Darling

It would be GREAT if we had a project on here to do all of the interfaces. (i.e. IOleObject etc.) We could work on doing the entire MSHTML.dll with all of the interfaces etc. This is what kills me constantly.

Love the site! Great help!

James Hancock

Adam, this is an excellent and innovative site. I will bookmark it and share it with our programmers. Thanks a lot!

Tommie Carter

Adam great work. Can we add msi.dll?

David M. Kean

[Thanks, I've added it. -Adam]

Code Syntax Highlighting Suggestion

Adam,

Greate Job! I installed Flexwiki out of the box and it is not the same. This site is much better (you fixed and improved a lot of things in Flexwiki). Now I am learning more about PInvoke

If I may suggest, how about code syntax highlighting similar or better to what is done in http://wikiserver.has.it ? That is, for example, in the preformatted part, <PRE> If it starts with '//' highlight Csharp words until the end </PRE>. Great for sample codes in this site. Or since this wiki is all about codes in C#, why not do syntax coloring in all preformatted texts? Just a thought.

Elrey Ronald (mailto:lambda326@hotmail.com)

So, Casey Chesnut and I (http://www.brains-n-brawn.com/) are working on some high-powered Compact Framework stuff and we realized that many of the P/Invoke calls here may not work for the Compact Framework. It may be useful to add a Flag or Field indicating whether it is or not supported by the Compact Framework. We could actually follow the pattern that the OpenCF people use in listing both the desktop and the CE P/Invokes on the same page and have it link to the right one. We can start making some contributions as well.

Sam Gentile (http://samgentile.com/blog/)

like from our email:

The marshalling restrictions are one problem, as well as which DLL is actually used. From the CF side, we usually do the dumb downed one to work on both desktop and device.

Then you only have to change which DLL the call goes to;

e.g. pointing to User32.dll for desktop or coredll on the device.

The OpenNetCF guys have a better pattern.

They implement it to work on both following the pattern below, to have the method work on both desktop and device.

Code

public static bool CPAcquireContext(out IntPtr phProv, StringBuilder pszContainer, uint dwFlags, byte[] pVTable){

  if(Environment.OSVersion.Platform == PlatformID.WinCE)
    return CPAcquireContextCe(out phProv, pszContainer, dwFlags, pVTable);
  else
    return CPAcquireContextXp(out phProv, pszContainer, dwFlags, pVTable);

}

[DllImport(“coredll.dll”, EntryPoint="CPAcquireContext", SetLastError=true)]

private static extern bool CPAcquireContextCe(out IntPtr phProv, StringBuilder pszContainer, uint dwFlags, byte[] pVTable);

[DllImport(“advapi32.dll”, EntryPoint="CPAcquireContext", SetLastError=true)]

private static extern bool CPAcquireContextXp(out IntPtr phProv, StringBuilder pszContainer, uint dwFlags, byte[] pVTable);

-- Sam Gentile

[The site already contains coredll.dll with its own pages, so hopefully that helps. Any advice you folks have on how to make the pinvoke.net site more useful for Compact Framework users is definitely appreciated! -Adam]

This site's been live for about a month, now -- either it's not getting indexed completely by Google, or there is nearly complete neglect for SetLastError=true. Or both.

http://www.google.com/search?q=SetLastError+site:pinvoke.net

http://www.windojitsu.com/blog/pleasesetlasterror.html

IMHO, the hardest part of developing a good p/invoke signature is not substituting "LPCSTR" with "string" -- it's looking up the failure semantics of the methods' return values... (NULL or INVALID_HANDLE? Does it SetLastError? etc.) And then wrapping the call appropriately.

Can we come up with some sort of standard, for that?

I'd go so far as to recommend always mandating SetLastError -- explicitly setting SetLastError=false, to call out the (comparatively rare) Win32 functions that don't expose a failure path through GetLastError.

And SetLastError is only half the problem -- remembering to actually check the return value is the other half! We should compel folks to check the return values properly, in the sample usage section -- assert success and/or throw Win32Exception, as appropriate.

-Shawn

http://www.windojitsu.com/

Any ideas about M3JPEG32.dll ? I'm trying to call a function from my code, but I probably don't have the correct parameters. I'll attach it in email. Thanks, Mechi

The site is great. I've managed to convince our nazi systems bods to allow access through our proxy. One thing is bothering me though, I've used the code for IActiveDesktop (and all associated enums and structs and whatnot) in C# and it doesn't seem to want to work. If I attempt to create a new instance of IActiveDesktop with "IActiveDesktop ad=new IActiveDesktop();" and try to change the desktop wallpaper I am told "Cannot create an instance of the abstract class or interface 'MyProject.MyClass.IActiveDesktop'". If I don't explicitly create a new instance, I get an error that tells me "Use of unassigned local variable 'ad'". Am I doing something stupid here?

Adam (extremely willing to be stupid if it'll help)

First, this is an awesome site! Thanks for putting this together. I have used it a great deal.

Second, I can't seem to find a way to add a new entry -- one that is not already in the tree. I wanted to add an Enum for the ShellProcCode -- the values that can be returned as the code for ShellProc events. I don't see one there unless it is under some other name. But a search for HSHELL_WINDOWCREATED came back empty. So, it seems it isn't there yet.

Rod

-

Please update the main page where it says,

"Folks like you are sharing gotchas, tips, and samples specific to managed code. For example, check out why you shouldn't call CoInitializeSecurity from managed code."

There is a workaround to call CoInitializeSecurity from managed code, I added the information to the documentation.

Thanks,

Arturo

A search by "GPS"(starGPSstar) is giving a error,

Sorin B.

I tried to add some info to the site, but I'm pretty disappointed by the hacked up formatting that gets applied when /// <SUMMARY> blocks are included. It would definitely be of value to the people stopping by here if the comments were retained.

-

Also see http://custom.programming-in.net/. I tried a couple VB .Net PInvoke's from here that didn't work. I modified them in my code and tried to correct here, but then I stumbled across the other site, that had things that made MDA happy that this site didn't. It doesn't have everything either and I got an error when I tried to submit sample code (and correction) there. Anyway, you might check there if something here is missing/doesn't work.

Genidiot

-

Is it possible to add our own modules to the left side? I didn't see a way to do it. Mainly, it is missing a lot of Windows CE (Smart Device) dll's. In particular, I was looking for toolhelp.dll. There is a few differences between this and the same functions/structures that are in kernel32.dll. So, could you please add this so I can share all my new knowledge with the rest of the world. Thanks.

I love this site, and I often end up making use of it - thanks for all the effort! A couple of points -

Many thanks to all involved, and keep up the good work! - Rich T