Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Managed C++ - Load Icon

Status
Not open for further replies.

Skute

Programmer
Jul 21, 2003
272
GB
Hi, im trying to load an icon into a NotifyIcon structure, however it wont work when i try to load from a resource:


m_pNotifyIcon->Icon = new System::Drawing::Icon(GetType(), "App.ico");

The only way i can get it to work is if i load it directly from disk (by doing Icon("App.ico")). But i would rather it load from the embedded icon in the resource. I have included the resource.h and the icons ID is IDI_APP.

Here is the code for the constructor:

frmSysTray::frmSysTray()
{
m_pContextMenu = new Windows::Forms::ContextMenu();
m_pContextMenu->MenuItems->Add("Test1");
m_pContextMenu->MenuItems->Add("Test2");

m_pNotifyIcon = new NotifyIcon();
m_pNotifyIcon->Icon = new Drawing::Icon(GetType(), "App.ico");
m_pNotifyIcon->ContextMenu = m_pContextMenu;
m_pNotifyIcon->Visible = true;
}

Cheers



Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top