In MFC How can we retrieve icon of an exe file?


Ans: The executable files of Paint Brush, Notepad, PowerPoint etc. have their own icons. If you want to use icon of one of these executables for your window use ExtractIcon( ) API function as shown below.

HICON hicon ;

hicon = ::ExtractIcon ( AfxGetApp( ) -> m_hInstance, “C:\\Windows\\pbrush.exe”, 0 ) ;

SetIcon ( hicon, FALSE ) ;

This code snippet shows how to set icon of Paint application to our window.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>