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
Hi Ann!<br>
<br>
You can do something like this:<br>
<br>
HICON h;<br>
h = (HICON)LoadResource(hInstance, FindResource(hInstance, szName, RT_ICON));<br>
<br>
Where hInstance is the instance handle of the module you want to get the resource from (NULL for current module), and szName is the name of the resource, or perhaps a resource ID (see MSDN for details).<br>
<br>
You can call LockResource(h) to access the raw resource information, and cast it to an icon structure.<br>
<br>
Don't forget to call DestroyIcon(h) when you are done with it. <br>
<br>
Chip H.<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.