‘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,…

79

GUID Generation and VB6 Binary Compatibility

When exposing managed types as COM types, your classes must have CLSIDs, your interfaces must have IIDs, and so on.  System.Runtime.InteropServices provides a custom attribute (GuidAttribute) that enables you to be explicit about these GUIDs.  But the CLR also has a reasonable algorithm for generating GUIDs on-the-fly, so you normally don’t need to be explicit…

54

Tech License Plates

Many people know about Don‘s infamous IUNKNWN and INFOSET license plates, but recently I’ve been noticing more technology-inspired license plates around town.  Just the other day at the grocery store, I saw a car with a GUID license plate.  And not that long ago I saw INT3 on one car and FFFF00 on another (bright yellow)…

38

XAML Playing Cards

Looking at the card games that ship with Windows XP, I think one of the most obvious opportunities for improvement is the look & feel of the playing cards.  These games use a shared library known as cards.dll to draw cards that look like… um… this: Don’t those look so 20th century?  To prepare for migrating Internet…

37

Quiz: What’s wrong with the following code?

The following C# code has the goal of enabling managed code to call CreateDC, but it’s incorrect.  Calling all Interop aficionados… Can you see what’s wrong? using System; using System.Runtime.InteropServices; internal class DeviceContext {   [DllImport(“gdi32.dll”, CharSet=CharSet.Auto)]   internal static extern IntPtr CreateDC(     string lpszDriver, string lpszDevice,     string lpszOutput, ref DEVMODE lpInitData); }…

36

Aero Glass inside a WPF Window

Recently Tim shared some code for extending Windows Vista Aero “Glass” inside a Windows Forms window.  It sounds like he’s eventually planning on showing this with WPF (among other things).  I also looked into this for my upcoming WPF book, and I couldn’t wait to share the results of my little WPF glass experiment!  Sorry, Tim,…

26

This just in: .NET and COM is coming back in print!

A few months ago I mentioned that my .NET and COM book went out of print.  Well, after getting regular streams of e-mail from people who still wanted to get a copy (which I forwarded on to the publisher), I can now happily say that they are planning to print more! I believe it’s going…

23

Announcing www.winfxhearts.com!

To correspond with my PDC talk about making an application “light up” on Windows Vista, I’ve created www.winfxhearts.com.  This site has a ClickOnce link that enables you can play a version of my new & improved Internet Hearts game.  Here’s a “before & after” look:     This is still the good ol’ Win32 application, but…

19

Windows Vista: It’s the little things…

…that make all the difference in the world to me.  I’ve been using Beta 1 a lot recently, and although “most of the stuff that we would expect that tech enthusiasts and consumers will be interested in will happen at Beta 2,” every once in awhile come across a small improvement that makes me much…

18

CLR SPY and Customer Debug Probes: The Thread Changing Apartment State Probe

The last blog touched on apartment states of managed threads, which the CLR tracks for COM interoperability purposes.  But if an application changes the apartment state of a thread being tracked by the CLR (via unmanaged code or direct calls to CoUninitialize/CoInitialize), the runtime won’t be aware of this change.  Its information for that thread…

16