Loading an Icon in C++/CLI
This turned out to be a tricky job, because the icons are stored in the resource as an unmanaged item. So the icon has to be loaded unmanaged, and then converted into the managed realm. The icon was loaded by opening the Resource View, and right-clicking on the Icon folder to insert a new icon. The following code snippet then loads the Icon from the resources into a managed object:
#include <windows.h>
#include "resource.h"
using namespace System::Reflection::Assembly;
using namespace System::Runtime::InteropServices;
using namespace System::Drawing;
// Get the primary module
Module ^ mod = GetExecutingAssembly()->GetModules()[0];
// Get the instance handle
IntPtr hinst = Marshal::GetHINSTANCE(mod);
// Get the...