Setting the Title Bar Icon

Posted on 2003-03-08
Medium Priority
Last Modified: 2013-11-20
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?
Question by:lonekorean
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8096907

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.

Expert Comment

ID: 8097858
why not open the resource editor and just draw the new icon on the previous one....

why all the trouble for just an icon ?!?!
LVL 12

Accepted Solution

rajeev_devin earned 200 total points
ID: 8101464
Insert the following code in your OnCreate() method of class CMainFrame.

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


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question