Click here to Skip to main content
15,891,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,I had a problem in displaying icon in button along with the Text in MFC application.. after reading lot of arctilces I got a solution for that and it worked great.But when I tested my application in win xp(SP2)..it suprised me by not showing the icon..Check the below code which i used to display the icon along with a test in button..Please let me know if there are any fix for this issue..waiting for your replies


HICON addIcon = (HICON)LoadImage(AfxGetApp()->m_hInstance,
                                  MAKEINTRESOURCE(IDI_ICO4), IMAGE_ICON,0,0,LR_DEFAULTCOLOR);		 	
	
SendMessageA(::GetDlgItem(m_hWnd,IDC_ADD),BM_SETIMAGE,IMAGE_ICON, (LPARAM)(DWORD)addIcon);
Posted
Updated 2-Feb-10 22:28pm
v4

1 solution

Is addIcon assigned to a valid handle. Check if your Loadimage is returning you a valid handle, my strong guess is IDI_ICO4 is not a valid icon.
HTH
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900