Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

A Beginner's question

Posted on 1999-07-26
2
Medium Priority
?
168 Views
Last Modified: 2010-04-02
Hi,
   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;
SYSTEMTIME sysTime;

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?



0
Comment
Question by:whluk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:whluk
ID: 1201091
Edited text of question.
0
 

Accepted Solution

by:
ChefInnocent earned 200 total points
ID: 1201092
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:
    GetDlgItem(IDC_TIME_STATIC)->SetWindowText(aString);
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.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question