How you create a button dynamically?

Answers were Sorted based on User's Feedback



How you create a button dynamically?..

Answer / venkataramakrishna

1. Create a Object from CButton control. CButton m_ctlButton
2.
m_ctlButton.Create("OK",ES_CHILD|ES_VISIBLE,CRect(0,0,100,100),CWnd*
pParentWnd,MB_OK);

with this we can create the button by dynamically.

Is This Answer Correct ?    12 Yes 3 No

How you create a button dynamically?..

Answer / 106743013743

CButton myButton1, myButton2, myButton3, myButton4;

// Create a push button.
myButton1.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
CRect(10,10,100,30), pParentWnd, 1);

// Create a radio button.
myButton2.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON,
CRect(10,40,100,70), pParentWnd, 2);

// Create an auto 3-state button.
myButton3.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_AUTO3STATE,
CRect(10,70,100,100), pParentWnd, 3);

// Create an auto check box.
myButton4.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX,
CRect(10,100,100,130), pParentWnd, 4);

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More MFC Interview Questions

What is the difference between ASSERT and VERIFY?

2 Answers  


What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example

6 Answers  


What four types of properties are supported by an ActiveX control?

1 Answers  


what is message loop how mfc does it internally?

4 Answers   Aspire,


Which MFC function is used to display output?

9 Answers   TCS,






How to create a Modeless Dialog?

5 Answers  


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

0 Answers  


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 initial function to be called in MFC and what it will do

11 Answers   Infosys,


1)How to change a text of a button in runtime?

2 Answers  


What is the use of message map ?

5 Answers   TCS,


How WM_PAINT message gets called in MFC,please explain it . a)Who calls the WM_PAINT message? b)When it gets called? c)how it comes to message queue? Please Explain it

8 Answers  


Categories