Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / jp

1. Only required to know the Control Resource ID

((CButton*)GetDlgItem(IDOK))->SetWindowText(_T("Hello"));

Is This Answer Correct ?    1 Yes 0 No

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

Answer / ps

1. make a control variable of button with the Cbutton class;
2. where you want to change the text then call only setwindowtext();

in header file;
Cbutton mButton;.
IN RESOURCE.H...
#DEFINE BUTTON_ID 249;// CONTROLL ID NUMBER 249 ANY YOU WNT OR SYSTEM GENRATED.
in cpp file.
'''''''mesage map
ABC::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, BUTTON_ID, mButton);
}
BOOL ABC::OnInitDialog()
{
// IF USER CHANGE ON INIT METHOD THEN CAN DO OR CHANGE IN ANY METHOD WITH THE SAME CLASS
mButton.setwindowText(_T"hello");


}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More MFC Interview Questions

what is the difference between SDI and MDI

15 Answers   CMC, HCL, Siemens,


how many types of messages are their

4 Answers   E Logic, TCS,


what is the use of CWinApp class?

3 Answers   Mphasis,


1) Enable or disable a Cancel button at run time?

1 Answers   HCL,


what is message loop how mfc does it internally?

4 Answers   Aspire,


How many types of dialog box are their

10 Answers   Honeywell,


what are the feauters of CObject

4 Answers   Siemens, Wipro,


What is model and modeless dialog box ? Give some examples?

2 Answers   Mphasis,


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

2 Answers  


Difference between Cclint DC & Cpaint Dc

6 Answers   E Logic,


Will there be any difference in the image buffer size if it is loaded in from CString to LPTSTR using GetBuffer()? lptstr = string.GetBuffer(0);

2 Answers  


What is the use of UpdateData funciton ?

7 Answers  


Categories