Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display an icon on a button 1

Status
Not open for further replies.

nanzp

Programmer
Feb 24, 2000
10
0
0
IE
Hi all,<br>
Could anyone tell me how to display an icon on a button with text in a dialog.<br>
I have come across the SetIcon method that takes a HICON as parameter but how to I get the handle to an icon that is a resource?<br>
Thanks in advance,<br>
Ann<br>

 
Try doing this<br>
add a icon resource, say IDC_ICON1 in the resources.<br>
then in the code, do<br>
HICON hIcon = ::LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_ICON1));<br>
then you have a button<br>
try doing<br>
pButton-&gt;SetIcon(hIcon);<br>
This should do it.<br>
If it does not, then please let me know if the button is on a Dialog os you have explicitly created a Button by calling CButton classes create<br>
<br>
<br>
All the best.<br>
Sun<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top