Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1606
  • Last Modified:

Setting the Title Bar Icon

I'm making a Windows program using C++/MFC/Visual Studio .NET. Right now, the icon in the left corner of the windows title bar is just a default Windows icon. How do I change it to my own custom icon?
0
lonekorean
Asked:
lonekorean
1 Solution
 
Vinayak KumbarSr Program ManagerCommented:
Hi,

Add the custom icon both 32x32 and 16x16 using resource editor with id IDI_MYICON.

the do something like this from ur mainframe or dlg class

HICON hIcon;
hIcon = ::LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_MYICON));
SetIcon(hIcon, FALSE);

Try it out.
VinExpert
0
 
kozmo_jonnyCommented:
why not open the resource editor and just draw the new icon on the previous one....

why all the trouble for just an icon ?!?!
0
 
rajeev_devinCommented:
Insert the following code in your OnCreate() method of class CMainFrame.

HICON hicon;
hicon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
SetIcon(hicon, NULL);

Thanx
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now