E:\实例\Communication\CommunicationDlg.cpp(229) : error C2601: 'OnChangeTitle' : local function definitions are illegal
E:\实例\Communication\CommunicationDlg.cpp(252) : error C2601: 'OnTimer' : local function definitions are illegal
E:\实例\Communication\CommunicationDlg.cpp(264) : error C2601: 'OnAddToTray' : local function definitions are illegal
E:\实例\Communication\CommunicationDlg.cpp(278) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
void CCommunicationDlg::OnChangeTitle()
{
CTime time;
CString strWeek;
CString strTime;
CString strCaption;
time=CTime::GetCurrentTime();
strTime=time.Format("%Y-%m-%d");
switch(time.GetDayOfWeek())
{
case 1: strWeek = "礼拜天" ;break;
case 2: strWeek = "礼拜一" ;break;
case 3: strWeek = "礼拜二" ;break;
case 4: strWeek = "礼拜三" ;break;
case 5: strWeek = "礼拜四" ;break;
case 6: strWeek = "礼拜五" ;break;
case 7: strWeek = "礼拜六" ;break;
}
AfxGetMainWnd()->GetWindowText(strCaption);
strCaption+="[今天是:" + strTime +"--"+strWeek+"]";
AfxGetMainWnd()->SetWindowText(strCaption);
}
void CCommunicationDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CTime time;
CString strTime;
time=CTime::GetCurrentTime();
strTime=time.Format("%H : %M : %S");
m_bar.SetPaneText(1,strTime);
m_bar.SetPaneText(0,"********");
CDialog::OnTimer(nIDEvent);
}
BOOL CCommunicationDlg::OnAddToTray()
{
HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_nc.cbSize = sizeof(NOTIFYICONDATA);
m_nc.hWnd = GetSafeHwnd();
m_nc.uID = 0;
m_nc.hIcon = hIcon;
m_nc.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
m_nc.uCallbackMessage = WM_TRAY_NOTIFY;
CString strTip;
GetWindowText(strTip);
strcpy (m_nc.szTip, strTip);
// Set the tray icon
Shell_NotifyIcon(NIM_ADD, &m_nc);
} //E:\实例\Communication\CommunicationDlg.cpp(278) : fatal error C1004: unexpected end of file found
帮帮忙吧~~ 谢了先~~