i need to convert CString to UINT and CString to COleDateTime i find no function that enable me to do that <br>
any help would be appreciate thanks<br>
To convert a CString to a UINT I would use the LPCTSTR operator, then use atoi. Example: <br>
UINT foo (CString in)<br>
{<br>
return atoi(LPCTSTR(in));<br>
}<br>
<br>
Converting a CString to a COleDateTime completely depends on the structure of the CString. There are constructors that take the date and time in many different formats. <br>
<br>
There is probably a pretty slick way to do this that I can't think of right now, but you could pretty easily hack something together.<br>
<br>
For example, if the CString contains "MM/DD/YY HH:MM:SS" you could parse out each element and construct a COleDateTime with the following constructor:<br>
<br>
COleDateTime::COleDateTime(int nYear,int nMonth,int nDay,int nHour,int nMin,int nSec);<br>
<br>
Here are the other constructors that VC+ HELP lists:<br>
<br>
COleDateTime( );<br>
COleDateTime(const COleDateTime&);<br>
COleDateTime(const VARIANT&);<br>
COleDateTime(DATE);<br>
COleDateTime(time_t);<br>
COleDateTime(const SYSTEMTIME&);<br>
COleDateTime(const FILETIME&);<br>
COleDateTime(WORD wDosDate, WORD wDosTime);<br>
<br>
<p>Pat Gleason<br><a href=mailto:gleason@megsinet.net>gleason@megsinet.net</a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.