Solved

ODBC - CRecordset - CRecordview (Urgent)

Posted on 2000-03-09
4
189 Views
Last Modified: 2013-11-20
Problem:
I have developed an SDI application using AppWizard. I am using visual C++ version 6.0. I am using MFC and visual c++.

Question:

How do i create the icon for my application?
       


Regards

Eugene
0
Comment
Question by:eugene007
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
VinExpert earned 25 total points
ID: 2599797
Hi,

1. Open the resource editor.
2. From the Insert menu option select Resource.
3. Then select icon, and say OK.
4. U will get icon editor. Give the ID, say ID_MY_ICON and put the image.
5. Save it.

Thats it. Now to aplly that icon to Ur app. do as

HICON hicon = ::LoadIcon(0, MAKEINTRESOURCE(ID_MY_ICON));
AfxGetMainWnd()->SetIcon(hicon);

If U want to change the existing MFC icon,
1. Open the resource editor.
2. select icons->IDR_MAINFRAME and change the image for both 32x32 and 16x16 icons.

Hope this helps.

VinExpert
0
 

Author Comment

by:eugene007
ID: 2600084
HICON hicon = ::LoadIcon(0, MAKEINTRESOURCE(ID_MY_ICON));
AfxGetMainWnd()->SetIcon(hicon);


Problem: I am facing a problem in this part of the code:

AfxGetMainWnd()->SetIcon(hicon);

Another things i have placed this coding in the constructer of the CWinApp class. Is it ok.


Regards

Eugene




0
 
LVL 8

Expert Comment

by:VinExpert
ID: 2600368
Hi,

Don't place it in the constructor. But U can place it at the end of the InitInstance(), before returning as

HICON hicon = ::LoadIcon(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_MY_ICON));
AfxGetMainWnd()->SetIcon(hicon, FALSE);

This will solve Ur problem.

VinExpert
0
 
LVL 5

Expert Comment

by:vachooho
ID: 2602698
Why guys you create new icon for AppWizard generated application

You have IDR_MAINFRAME icon in resources
change the shape of it and all neccessary code to set icon in main window is already written in MFC.

0

Featured Post

Independent Software Vendors: 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: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

685 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