[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

ODBC - CRecordset - CRecordview (Urgent)

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
eugene007
Asked:
eugene007
  • 2
1 Solution
 
Vinayak KumbarSr Program ManagerCommented:
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
 
eugene007Author Commented:
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
 
Vinayak KumbarSr Program ManagerCommented:
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
 
vachoohoCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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