3

i am recently editing an open source project in visual c++ 2010 , i don't know much about vc++ ,(i have only 5 days of experience in c++), with my little knowledge i am changing some user interface of the project

there is only one icon in my project ,the apps shows the main icon as icon , at the same time i want to make that icon to be on the title of a dialog also (the dialog will be shown when a button in main form is clicked),

the dialog is already in the resources/dialogs but i want to change the icon of it ;

Singleton
  • 3,701
  • 3
  • 24
  • 37
Vibeeshan Mahadeva
  • 7,147
  • 8
  • 52
  • 102
  • 1
    If you really only have 5 days of experience in C++, [please pick up a good C++ book](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) and read through it. Learn the principles and theory then apply it by trying out personal projects of your own. I don't mean to be offensive or anything like that, but before you go editing around an open source C++ project, go learn proper C++ first. – In silico Nov 26 '10 at 05:53
  • Then editing an existing open source project is not the way to go. It's okay to read open source code and see how its done, but you should first try building your own applications and start your own personal projects. Then, once you're comfortable doing that, then you can take on bigger projects. Start out small first. – In silico Nov 26 '10 at 05:56
  • @In silico yes you a correct but i am in a process of developing project mainly using delphi but this is a part i need to do small changes in vc++ app – Vibeeshan Mahadeva Nov 26 '10 at 05:59
  • Is this using plain Win32 API or a framework like MFC? – casablanca Nov 26 '10 at 06:00
  • just win32 ftp://ftp.altap.cz/pub/altap/salamand/sfx7zip.zip – Vibeeshan Mahadeva Nov 26 '10 at 06:01

1 Answers1

3

You need to find the dialog procedure of the dialog you're interested in, and in the WM_INITDIALOG message handler (you need to add it if it's not already present) use WM_SETICON to set the icon:

// hIcon is your icon handle
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
casablanca
  • 69,683
  • 7
  • 133
  • 150