/*************Header File****************************/
#include<afxwin.h>
class CMyWnd : public CFrameWnd // My Window class
{
public:
CMyWnd();
afx_msg void OnTimer(UINT ID);
DECLARE_MESSAGE_MAP()
};
class CMyApp: public CWinApp // Application window class
{
public :
BOOL InitInstance(); // initinstace function with Boolian return type
};
/***************Source File**************************/
#include "header.h" // Include header file
#include <time.h>
CMyWnd :: CMyWnd()
{
Create(NULL,"MyWindow"); // Use of Constructer
}
afx_msg void CMyWnd::OnTimer(UINT ID)
{
char s[15];
CClientDC dc (this);
CTime t=CTime::GetCurrentTime();
struct tm *ntime;
ntime=t.GetLocalTm();
wsprintf(s,asctime(ntime));
//AfxMessageBox(s);
dc.TextOut(250,250,s,strlen(s)-1);
}
BOOL CMyApp :: InitInstance()
{
CMyWnd *c=new CMyWnd();
m_pMainWnd=c;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->SetTimer(10,1000,NULL);
//MessageBox(m_pMainWnd,"hI","hOW R U",1); //use of message box
return true;
}
BEGIN_MESSAGE_MAP(CMyWnd,CFrameWnd)
ON_WM_TIMER()
END_MESSAGE_MAP()
CMyApp app;
I was finding this code because I missed it..It is working and accurately..
data hard drive
cplusplus program codes for beginner c++ coders
Cpu scheduling code in c++ language