Visual C++ Interview Questions and Answers

Visual C++ Questions and Answers:

1 :: How to change the Mouse Pointer Over a Button at runtime?

Assuming that you have set the button's ID as IDC_BTNSAMPLE in the resource editor :-
// You have to handle the WM_SETCURSOR message handler to do that
BOOL CTestDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (pWnd == GetDlgItem(IDC_BTNSAMPLE))
{ // To load a standard cursor
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_CROSS));
// To load your own custom cursor. Assuming that you have created a
// Cursor in the resource editor and named it as IDC_CURSAMPLE
::SetCursor(AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_CURSAMPLE)));
// Remember to return TRUE here return TRUE;
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
4/5 Rating (1 vote)
Is This Answer Correct?    0 Yes 1 No
Place Your Answer

2 :: How to change the Properties of a Button at runtime?

Assuming that you have set the button's ID as IDC_BTNSAMPLE in the resource editor :-
We have to use the ModifyStyle Function to do this. The function is defined as follows :-
CButton *pBtnSample = (CButton *)GetDlgItem(IDC_BTNSAMPLE); // Make the button look like a checkbox
pBtnSample->ModifyStyle(0,BS_AUTOCHECKBOX,SWP_FRAMECHANGED); // Remove the checkbox style and make it again normal
pBtnSample->ModifyStyle(BS_AUTOCHECKBOX,0,SWP_FRAMECHANGED);
5/5 Rating (1 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

3 :: How to change the position of Button at runtime?

Assuming that you have set the button's ID as IDC_BTNSAMPLE in the resource editor :-
CButton *pBtnSample = (CButton *)GetDlgItem(IDC_BTNSAMPLE);
pBtnSample->SetWindowPos(0,0,0,100,100,SWP_FRAMECHANGED);
0/5 Rating (0 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

4 :: How to change the Size of CButton at Runtime?

CButton *btnsample = (CButton *)GetDlgItem(IDC_BUTTON1);///suppose IDC_BUTTON1 is the ID of CButton/
btnsample->SetWindowPos(0,0,0,100,100,SWP_FRAMECHANGED);
0/5 Rating (0 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

5 :: How to Enable and Disable CButton at runtime?

CButton *btnsample = (CButton *)GetDlgItem(IDC_BUTTON1);
btnsample->EnableWindow(FALSE); // To Disable a button
btnsample->EnableWindow(TRUE); //To Enable a Button
0/5 Rating (0 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

Rate This Category:
0/5 Rating (0 vote)
Place Your Question



Top: Visual C++ Interview Questions and Answers
Visual C++ Interview Questions and Answers

Top Frequently Asked Visual C++ Question
Frequently Asked Visual C++ Job Interview Question


Top Frequently opened Computer Programming Job Interview categories
Most popular Computer Programming Job Interview categories

Comments About Visual C++ Interview Questions and Answers

Share your valuable opinions, ideas and suggestions about Visual C++ Interview Questions and Answers
While placing your comment your email address is required but won't be published any where else; Personal information will be kept confidential; we do not sell or release our respective visitors private information.
  1. Webmaster 23rd of May 2012

    Webmaster Said

    Tell us what you feel about Visual C++ Interview Questions and Answers
    All comments will be published after review. No login or registration is required to post a comment on Visual C++ Interview Questions and Answers We offer and invite you to submit your valuable comment now; Please be respectful of others when commenting. Insulting others, self-promotional comments, website promotional comments, marketing stuff, SEO Techniques, SMS-style content and off-topic comments will not be approved at this information portal.
    So start sharing your thoughts regarding Visual C++ Interview Questions and Answers
    Thank you.

Leave a Comment

Leave a Comment
  1.  Enter This Verification Code  Regenerate Verification Code  



Your reply will be added to the comment above (Below any other replies to this comment) -

Top Comments About: Visual C++ Interview Questions and Answers
Comments on Visual C++ Interview Questions and Answers

 
Top of Link batk to Visual C++ Interview Questions and Answers
Link batk to Visual C++ Interview Questions and Answers