I am using VC6 and the compiler is Win32 (for my university project). I have got several buttons on my dialog and I want to add different icons corresponding to different buttons.
I tried this code, as my button called IDC_BTN_AUTOSET
and my icon is called IDR_MAINFRAME
. This code gives no error, but it does not show me anything even if I change the button property to icon.
HICON h_Ico = (HICON) LoadImage( AfxGetResourceHandle(),"IDR_MAINFRAME", IMAGE_ICON, 32, 32,LR_LOADFROMFILE );
CButton *Button=(CButton*)GetDlgItem(IDC_BTN_AUTOSET);
Button->SetIcon( h_Ico );
SetIcon(h_Ico, TRUE);
SetIcon(h_Ico, FALSE);