2- In the view menu chose resource and then add New resource and then add ID_TIME_STATUSBAR and accept the defaul value (101) .
3- Add message handler and update message handler in the CMainFrame class for both ID_VIEW_STATUS_BAR .
4- Replace the previously created indicators array with single ID_SEPARATOR and make sure that the CMainFrame data member m_wndStatusBar is public instead of protected so that it can be accessed from the View class .
5- Replace if (!m_wndStatusBar.Create(this) with this, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, ID_TIME_STATUSBAR) ;
6- Add the following code to ur CMainFrame.cpp
void CMainFrame::OnViewStatusBar()7- Add the following function OnDraw to your View class pDC->TextOut(30, 30 ,Press the left key to see your computer current time on the status bar ");
{
m_wndStatusBar.ShowWindow((m_wndStatusBar.GetStyle() &
WS_VISIBLE) == 0);
RecalcLayout();
}
void CMainFrame::OnUpdateViewStatusBar(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck((m_wndStatusBar.GetStyle() & WS_VISIBLE) != 0);
}
8- Edit OnDraw messege handler as follows
CTime currenttime = GetCurrentTime();
int sec , min , hours ;
hours = currenttime.GetHour();
min = currenttime.GetMinute();
sec = currenttime.GetSecond();
CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
CStatusBar* pStatus = &pFrame->m_wndStatusBar;
CString strtime ;
strtime.Format( "%d %d %d ", hours,min , sec );
pStatus->SetPaneText(0, strtime );
Finally include #include "MainFrm.h" near the top with other include statements
to download the exe file click here
and the whole project here
this contains sum errors
thanks very helpful
ReplyDeletejimmy choo shoes, converse outlet, north face outlet, insanity workout, soccer jerseys, wedding dresses, nike air max, ralph lauren, mcm handbags, oakley, hollister, lululemon, mont blanc, valentino shoes, vans shoes, vans, abercrombie and fitch, nike huarache, new balance, hollister, bottega veneta, nike trainers, birkin bag, celine handbags, ghd, soccer shoes, asics running shoes, instyler, timberland boots, beats by dre, nfl jerseys, converse, reebok shoes, nike roshe, hollister, ferragamo shoes, p90x workout, gucci, louboutin, north face outlet, iphone cases, babyliss, chi flat iron, baseball bats, longchamp, ray ban, nike air max, herve leger, mac cosmetics
ReplyDelete