1)How to load an icon on a button as Dynamically ?



1)How to load an icon on a button as Dynamically ?..

Answer / 106743013743

Hi Frienz,

Example:-

BOOL Ctharam::OnInitDialog()
{
CDialog::OnInitDialog();

// Below Below, to load icon on button as Dynamic
CButton *btnsample = (CButton *)GetDlgItem(IDC_BUTTON1);
btnsample->ModifyStyle(0,BS_ICON,SWP_FRAMECHANGED);
HICON hIcon = LoadIcon(AfxGetResourceHandle(),
(LPCTSTR)IDI_ICON1);
btnsample->SetIcon(hIcon);

return TRUE;

}

I hope, it might be helpful to you!!!!

By Ctharam

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More MFC Interview Questions

What is the initial function to be called in MFC and what it will do

11 Answers   Infosys,


what if we provide two message handler for same message ?

1 Answers  


Can you explaing the relashionship between document,frame and view ?

2 Answers  


What is the difference between the ASSERT and VERIFY macros?

4 Answers  


Hi All, i am new for VC++ SDK. i want to get the IP Address of all the External device connected with my local machine.please give the code Regards, Praveer

1 Answers   TCS, Tech Mahindra,


what is the use of Mutex and critical section

2 Answers  


How to handle dynamic menus in mfc? What happens when client calls cocreateinstance?

1 Answers  


What is the base class for MFC Framework ?

2 Answers   Mphasis,


What are the special requirements for dialog box resources used in a form view?

2 Answers  


what is message loop how mfc does it internally?

4 Answers   Aspire,


if both base and derived class have the constructors if i create an object for derive class which class constructor is executed first

10 Answers   Siemens, Symphony,


what is the use of AFX_MANAGE_STATE ?

4 Answers   HCL,


Categories