vC++unexpected end of file foundvoid CCalculator2Dlg::OnOffButton() { CString initialCaption, newCaption; GetDlgItemText(IDC_OFF_BUTTON, initialCaption); if (initialCaption == "&Power Off") { newCaption = "&Power On"; // -- hide all the controls

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/09 15:16:13
vC++unexpected end of file foundvoid CCalculator2Dlg::OnOffButton() { CString initialCaption, newCaption; GetDlgItemText(IDC_OFF_BUTTON, initialCaption);  if (initialCaption ==

vC++unexpected end of file foundvoid CCalculator2Dlg::OnOffButton() { CString initialCaption, newCaption; GetDlgItemText(IDC_OFF_BUTTON, initialCaption); if (initialCaption == "&Power Off") { newCaption = "&Power On"; // -- hide all the controls
vC++unexpected end of file found
void CCalculator2Dlg::OnOffButton()
{
CString initialCaption, newCaption;
GetDlgItemText(IDC_OFF_BUTTON, initialCaption);
if (initialCaption == "&Power Off")
{
newCaption = "&Power On"; // -- hide all the controls
// -- CButton objects
//CButton *pButton = (CButton*) GetDlgItem(IDC_ADD_BUTTON);
//pButton ->ShowWindow(FALSE);
GetDlgItem(IDC_ADD_BUTTON)->ShowWindow(FALSE);
CButton *pButton;

pButton = (CButton*) GetDlgItem(IDC_SUB_BUTTON);
pButton ->ShowWindow(FALSE);
pButton = (CButton*) GetDlgItem(IDC_MUL_BUTTON);
pButton ->ShowWindow(FALSE);
pButton = (CButton*) GetDlgItem(IDC_DIV_BUTTON);
pButton ->ShowWindow(FALSE);
pButton = (CButton*) GetDlgItem(IDC_TOGGLE_BUTTON);
pButton ->ShowWindow(FALSE);

// -- CEdit objects
CEdit *pEdit = (CEdit*) GetDlgItem(IDC_NUM1_EDIT);
pEdit ->ShowWindow(FALSE);
pEdit = (CEdit*) GetDlgItem(IDC_NUM2_EDIT);
pEdit ->ShowWindow(FALSE);
pEdit = (CEdit*) GetDlgItem(IDC_RESULT_EDIT);
pEdit ->ShowWindow(FALSE);
// -- CScrollBar objects
CScrollBar *pSB = (CScrollBar*) GetDlgItem(IDC_NUM1_SCROLLBAR);
pSB ->ShowWindow(FALSE);
pSB = (CScrollBar*) GetDlgItem(IDC_NUM2_SCROLLBAR);
pSB ->ShowWindow(FALSE);
}
else
{
newCaption = "&Power Off"; // -- show all the controls
// -- CButton objects
CButton *pButton = (CButton*) GetDlgItem(IDC_ADD_BUTTON);
pButton ->ShowWindow(TRUE);

pButton = (CButton*) GetDlgItem(IDC_SUB_BUTTON);
pButton ->ShowWindow(TRUE);
pButton = (CButton*) GetDlgItem(IDC_MUL_BUTTON);
pButton ->ShowWindow(TRUE);
pButton = (CButton*) GetDlgItem(IDC_DIV_BUTTON);
pButton ->ShowWindow(TRUE);
pButton = (CButton*) GetDlgItem(IDC_TOGGLE_BUTTON);
pButton ->ShowWindow(TRUE);

// -- CEdit objects
CEdit *pEdit = (CEdit*) GetDlgItem(IDC_NUM1_EDIT);
pEdit ->ShowWindow(TRUE);
pEdit = (CEdit*) GetDlgItem(IDC_NUM2_EDIT);
pEdit ->ShowWindow(TRUE);
pEdit = (CEdit*) GetDlgItem(IDC_RESULT_EDIT);
pEdit ->ShowWindow(TRUE);
// -- CScrollBar objects
CScrollBar *pSB = (CScrollBar*) GetDlgItem(IDC_NUM1_SCROLLBAR);
pSB ->ShowWindow(TRUE);
pSB = (CScrollBar*) GetDlgItem(IDC_NUM2_SCROLLBAR);
pSB ->ShowWindow(TRUE);
}
// -- update the caption of the power button
SetDlgItemText(IDC_OFF_BUTTON, newCaption);
// -- reset the diolog box to its initial state
OnInitDialog();
return;
}
在MICRO VS2005没问题,但到VC6.0就不行了,这个CODE是VC6.0的其实.
fatal error C1004: unexpected end of file found
Error executing cl.exe.
还有这个问题.好奇怪啊.程序在VS2005都没问题.而且这些CODE都是VC++的

vC++unexpected end of file foundvoid CCalculator2Dlg::OnOffButton() { CString initialCaption, newCaption; GetDlgItemText(IDC_OFF_BUTTON, initialCaption); if (initialCaption == "&Power Off") { newCaption = "&Power On"; // -- hide all the controls
vc6.0和vs2005并不完全一样,你看看return或是}吧.