[RESOLVED] How to add a cursor resource to my app (VC++ 2010 Express)
Well, maybe this would be easy if I had the Pro Edition with the integrated resource editor, but unfortunately I only have the Express Edition and tried to add a cursor resource from a .cur file to my app.
What I couldn't get to work:
Add the .cur file as a file resource to Form1.resX (right click on Form1.resX in the project explorer etc.) and try to construct the Cursor object using the Cursor(Type ^, String ^) constructor as described on MSDN. The resource option as described on the MSDN page for VB .NET and C# doesn't exist for cl. Maybe it could actually be done that way, but then I couldn't figure out how to obtain the correct Type ^ argument for the constructor.
Add a reference to the .cur file in the .rc file (by editing it manually), invoking the native LoadCursor() and trying the Cursor(IntPtr) constructor.
If I don't mess up my memory now, both of these attempts resulted in the Cursor constructor failing and thus gcnew returning nullptr.
I actually could construct the Cursor object from the .cur file on disk, but as the app consists only of a sole .exe file up to now, I didn't want to add the extra ballast of the .cur file.
I finally resorted to convert the .cur file to a bunch of hex literals (hidden inside the macro in the code below) and construct the Cursor from a MemoryStream constructed from the array<unsigned char>:
Bookmarks