Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   using drawtext() (http://www.go4expert.com/forums/using-drawtext-t20730/)

palz 22Jan2010 01:58

using drawtext()
 
i have used DrawText() to display time init.i have used DT_CENTER which is display time in center even if window is minimised or maximised.

but how to display it to right side of window but not on the minimise,maximise and close buttons.

i tried DT_RIGHT =it is displaying on those 3 buttons (minimise,maximise and close buttons)

Code:

              void CMainFrame::OnTimer(UINT_PTR nIDEvent)
            {
                HWND hWnd;
                hWnd = ::GetForegroundWindow();
                CWnd *pWnd;
                pWnd = CWnd::FromHandle(hWnd);
                CTime Time = CTime::GetCurrentTime();
                CString strTime=Time.Format("%H:%M:%S");

                CWindowDC dc(this);
                CRect rect;
                GetClientRect(&rect);

                dc.DrawText(strTime,-1,&rect,DT_CENTER);
             
                //pWnd->SetWindowText(strTime);

            }

also i am not able to display time on ActiveWIndow (GetForegroundWindow()) if i use DrawText() .

If i use pWnd->SetWindowText(strTime) ,time is displayed on ActiveWindow(GetForegroundWindow()).

what is the problem.
plzzzzzz help me solve this problem


All times are GMT +5.5. The time now is 20:59.