Well after 3 1/2 Hours I’ve got the first example program “SystemDrawingDemo” rewritten in C#. I was prepared to experiment with the VB code, but for a really clever reason I unselected VB when I installed VS2005, because who would ever need that feature? I good chunk of that time was spent trying to work out how to get the HInstance so I could extract the icon from exe’s.
So this VB code
Dim hIcon As IntPtr = ExtractIcon(Microsoft.VisualBasic.Compatibility.VB6.GetHInstance, file.FullName, 0)
becomes
IntPtr hInstance = (IntPtr)Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]).ToInt32();
IntPtr hIcon = ExtractIconA( hInstance, file.FullName, 0);
Which just smells like fragile code to me. But it’s only demo code….
I’ll post my code once I’ve converted the lot.