I have decided to port an application that I wrote In C# in Managed C++ as I see that there is an advantage of mixing (directly,without DLL) managed and unmanaged code.I am mainly a pure C++ Win32 programmer.
The app is WinForm based.Under C#, I had this :
public static extern IntPtr CreateIconIndirect(ref IconInfo icon);
public struct IconInfo
public bool fIcon;
public int xHotspot;
public int yHotspot;
public IntPtr hbmMask;
public IntPtr hbmColor;
public static Cursor CreateCursor(Bitmap bmp, int xHotSpot, int yHotSpot)
IntPtr ptr = bmp.GetHicon();
IconInfo tmp = new IconInfo();
GetIconInfo(ptr, ref tmp);
tmp.xHotspot = xHotSpot;
tmp.yHotspot = yHotSpot;
tmp.fIcon = false;
ptr = CreateIconIndirect(ref tmp);
return new Cursor(ptr);
I need the same think in managed c++,in order to be able to use the resulting cursor in managed code,so,I wrote that:
The problem is that the GetIconInfo call fails (IconInfo structure containt is mostly NULL).
I am a bit confused from what I learnt the managed C++ has two new operators for unmanaged (^ = * and % = &),maybe I am wrong with the call?!
I would like also to say that it is very hard to find good information about managed C++,I think
that this language is very powerfull for heavy processing (MFC is dead,there is WinForms and still able to use fast unmanaged).