Welcome to MSDN Blogs Sign in | Join | Help

jaredpar's WebLog

Code, rants and ramblings of a programmer.

Syndication

News

Now Reading

Expert F#

What's a better book to read when learning F#?

Essential WPF

Thus far the best book I've read on WPF. Gets right down to working with WPF and the goals/history.

Purely Functional Data Structures

Reading this book makes me feel like I'm back in college. It will really get your mind going and is best read with a whiteboard handy.

Blog Roll

Eric Lippert
Dustin Campbell
Jon Skeet
Coding Horror
Brian McNamara
Hub FS
Full List

Browse by Tags

All Tags » PInvoke   (RSS)
Properly Incrementing an IntPtr
Just as native pointer types are moved around with pointer arithmetic in native code, it can also be useful to move IntPtr types around in managed code.  Say for instance there is an IntPtr available which points to a native array of Dog instances.  Read More...

Posted Tuesday, November 11, 2008 8:00 AM by Jared Parsons | 7 Comments

Filed under: ,

Dereference a double IntPtr
A common PInvoke question is how to deal with a double pointer.  More specifically, how can one dereference an IntPtr to another pointer without using unsafe code?  Dereferencing a double pointer is done the same way a dereference to any other Read More...

Posted Wednesday, November 05, 2008 8:00 AM by Jared Parsons | 3 Comments

Filed under: ,

Is IntPtr(long) truncating?
The short answer is: No, not when it matters A colleague and I were discussing a particular scenario around IntPtr,PInvoke and 64 bit correctness.  Eventually our discussion lead us to the IntPtr constructor which takes a long.  To my surprise Read More...

Posted Tuesday, October 28, 2008 8:00 AM by Jared Parsons | 1 Comments

Filed under: , ,

PInvoke and bool (or should I say BOOL)?
Boolean value types are a constant source of problems for people attempting to generate PInvoke signatures. It's yet another case of managed and native types differing on size. There are two common boolean types in native code: bool and BOOL. As with Read More...

Posted Tuesday, October 14, 2008 8:00 AM by Jared Parsons | 0 Comments

Filed under: ,

When is a LONG not a long?
Answer: When PInvoke is involved. I ran across a common error today on stackoverflow regarding P/Invoke that is worth blogging about. The question regarded the translation of a native API with a parameter of type LONG. The user mistakenly used the .Net Read More...

Posted Thursday, October 02, 2008 8:00 AM by Jared Parsons | 1 Comments

Filed under:

PInvoke Interop Assistant on Channel 9
Beth Massi dropped by my office a couple of months ago and we did a channel 9 video on the PInvoke Interop Assistant .  Mainly an overview of the product and a bit of a tutorial.  Check out the video here. http://channel9.msdn.com/posts/funkyonex/The-P-Invoke-Interop-Assistant Read More...

Posted Thursday, September 11, 2008 8:00 AM by Jared Parsons | 1 Comments

Filed under: ,

PInvoke Interop Assistant now on CodePlex
I'm happy to announce that the PInvoke Interop Assistant tool is now available on CodePlex.  This includes the binaries, source code and the dev authored unit tests.  It is hosted on the more general CLR Interop Tools page.  http://www.codeplex.com/clrinterop Read More...

Posted Tuesday, June 17, 2008 8:00 AM by Jared Parsons | 4 Comments

Filed under:

Making PInvoke Easy
I very excited to announce we recently released a tool I've been working on to MSDN that will greatly help with using PInvoke in managed code. The tool is called the "PInvoke Interop Assistant" and is included as part of a MSDN article on marshalling Read More...

Posted Friday, March 14, 2008 12:58 PM by Jared Parsons | 3 Comments

Filed under:

Follow up: PInvoke with 32 and 64 bit
Recently after I made my original post titled “PInvoke with 32 and 64 bit”, a developer emailed me. They pointed out that there is an internal structure that dynamically resizes based on the architecture; IntPtr. IntPtr will be size of the native chip Read More...

Posted Thursday, April 13, 2006 5:44 PM by Jared Parsons | 0 Comments

Filed under:

Marshaling Nested Data Structures Part 4
This is part 4 of a series. You can find part one here . Please refer to that article for all of the Native definitions of the structures that I use here. In the previous article we were left with a solution where using the code was very clean but the Read More...

Posted Monday, July 18, 2005 9:51 AM by Jared Parsons | 0 Comments

Filed under:

Marshaling Nested Data Structures Part 3
This is part 3 of a series. You can find part one here . Please refer to that article for all of the Native definitions of the structures that I use here. In part 2 of this series I demonstrated how you can Marshal nested data structures by flattening Read More...

Posted Thursday, July 14, 2005 7:58 PM by Jared Parsons | 0 Comments

Filed under:

Marshaling Nested Data Structures Part 2
This is part 2 of a series. You can find part one here . Please refer to that article for all of the Native definitions of the structures that I use here. The most important thing to remember when Marshalling data is that the .Net Runtime really only Read More...

Posted Tuesday, July 12, 2005 11:00 AM by Jared Parsons | 2 Comments

Filed under:

Marshaling Nested Data Structures Part 1
A frequent question that pops up on newsgroups such as microsoft.dotnet.framework.interop is how to Marshal nested structures (and arrays of nested structures) via P/Invoke. The documentation on the subject that I have found usually only covers structures Read More...

Posted Monday, July 11, 2005 12:47 PM by Jared Parsons | 11 Comments

Filed under:

Interop and Unions
A frequent question I see pop up on news groups is how to create Unions in managed code for interop with P/Invoke. .NET does not directly support unions but you can use some Marshal magic to get them working. Take the following C union. union Foo { int Read More...

Posted Friday, May 13, 2005 12:31 PM by Jared Parsons | 1 Comments

Filed under:

Page view tracker