• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

A Beginner's question

   I need to get the system time and display it in a label or edit box. The resource name is IDC_STATIC.

I wrote a couple of lines in the OnPaint function:

CString aString;
CTime timeGo;

timeGo.GetAsSystemTime (sysTime);
timeGo.Format (aString);

And I am stucked here, because I don't know how to put the string in the label or edit box field
Can you help me out with this?

1 Solution
whlukAuthor Commented:
Edited text of question.
First you'll probably want to do is change the id from IDC_STATIC to something else like IDC_TIME_STATIC.  It's just a good idea because all statics get the same id otherwise.
  But, more importantly, you can then say:
The GetDltItem is a member of CDialog returning a CWnd, which is what we call SetWindowText on.  This can be handy for many other CWnd objects.
   Hope this helps.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now