Click here to Skip to main content
15,909,539 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Wrong date from CDateTimeCtl Pin
The NULL Developer13-Oct-05 1:35
professionalThe NULL Developer13-Oct-05 1:35 
GeneralRe: Wrong date from CDateTimeCtl Pin
ThatsAlok13-Oct-05 7:38
ThatsAlok13-Oct-05 7:38 
GeneralRe: Wrong date from CDateTimeCtl Pin
vikas amin13-Oct-05 20:15
vikas amin13-Oct-05 20:15 
GeneralRe: Wrong date from CDateTimeCtl Pin
ThatsAlok13-Oct-05 20:21
ThatsAlok13-Oct-05 20:21 
GeneralRe: Wrong date from CDateTimeCtl Pin
vikas amin13-Oct-05 21:28
vikas amin13-Oct-05 21:28 
GeneralRe: Wrong date from CDateTimeCtl Pin
vikas amin13-Oct-05 23:27
vikas amin13-Oct-05 23:27 
QuestionRe: Wrong date from CDateTimeCtl Pin
David Crow13-Oct-05 3:27
David Crow13-Oct-05 3:27 
AnswerRe: Wrong date from CDateTimeCtl Pin
vikas amin13-Oct-05 20:17
vikas amin13-Oct-05 20:17 
Thank you David
in the MSDN samples just search for floder named "cmnctrl1"
open the project and in the file "datetime.cpp" replace the function as below


<br />
<br />
<br />
void CDateTimePage::OnDTNotify(NMHDR *pHdr, LRESULT * pRes)<br />
{<br />
//->----declater the variable ----<br />
	CTime ct;<br />
	CString st;<br />
//->------------------------------<br />
<br />
switch( pHdr->code)<br />
	{<br />
		<br />
	case DTN_CLOSEUP:<br />
		m_lbNotifyList.AddString(_T("DTN_CLOSEUP"));<br />
		<br />
		break;<br />
	case DTN_DATETIMECHANGE:<br />
<br />
		m_lbNotifyList.AddString(_T("DTN_DATETIMECHANGE"));<br />
//->---------------------------------------------------------------------------<br />
//->this code added by Vikas Amin to display the date from the datetime control  //->in the listbox<br />
		(m_DateTime.GetMonthCalCtrl())->GetCurSel(ct);<br />
		ct.GetMonth ();<br />
		m_DateTime.UpdateData (TRUE);<br />
		st.Format(_T(" ---  %02d/%02d/%2d ---%2d"),ct.GetMonth(),ct.GetDay(),ct.GetYear(),((ct.GetDay())-12 ));<br />
		m_lbNotifyList.AddString(st);<br />
//->---------------------------------------------------------------------------<br />
		break;<br />
<br />
	case MCN_SELECT:<br />
		m_lbNotifyList.AddString(_T("asdf"));<br />
		break;<br />
<br />
	case DTN_DROPDOWN:<br />
		m_lbNotifyList.AddString(_T("DTN_DROPDOWN"));		<br />
		break;<br />
	case DTN_FORMAT:<br />
		m_lbNotifyList.AddString(_T("DTN_FORMAT"));<br />
		break;<br />
	case DTN_FORMATQUERY:<br />
		m_lbNotifyList.AddString(_T("DTN_FORMATQUERY"));<br />
		break;<br />
	case DTN_USERSTRING:<br />
		m_lbNotifyList.AddString(_T("DTN_USERSTRING"));<br />
		break;<br />
	case DTN_WMKEYDOWN:<br />
		m_lbNotifyList.AddString(_T("DTN_WMKEYDOWN"));<br />
		break;<br />
	}<br />
<br />
}<br />



The code in between the //->---- ... ... . //->-----
is added by me actully according to the theory it should display
the data in the datetime control but it displays a wrong date that
is 12 days before .

I found a solution to directly get the text from the date time control
with GetWindowText ();
but i have to parse it by my self & cannot use the direct function like GetMonth(),GetDay(),GetYear(),etc.

Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
QuestionRe: Wrong date from CDateTimeCtl Pin
David Crow14-Oct-05 2:44
David Crow14-Oct-05 2:44 
Questionhow to use Class matrix in VC++ Pin
chen100013-Oct-05 1:27
chen100013-Oct-05 1:27 
AnswerRe: how to use Class matrix in VC++ Pin
ddmcr13-Oct-05 1:31
ddmcr13-Oct-05 1:31 
GeneralRe: how to use Class matrix in VC++ Pin
chen100013-Oct-05 1:40
chen100013-Oct-05 1:40 
GeneralRe: how to use Class matrix in VC++ Pin
ddmcr13-Oct-05 2:13
ddmcr13-Oct-05 2:13 
GeneralRe: how to use Class matrix in VC++ Pin
chen100016-Oct-05 0:43
chen100016-Oct-05 0:43 
QuestionWant to read and write to video memory to process the display of the monitor Pin
dreammaker13-Oct-05 1:01
dreammaker13-Oct-05 1:01 
AnswerRe: Want to read and write to video memory to process the display of the monitor Pin
vikas amin13-Oct-05 2:28
vikas amin13-Oct-05 2:28 
AnswerRe: Want to read and write to video memory to process the display of the monitor Pin
l a u r e n13-Oct-05 17:19
l a u r e n13-Oct-05 17:19 
AnswerRe: Want to read and write to video memory to process the display of the monitor Pin
normanS13-Oct-05 19:42
normanS13-Oct-05 19:42 
AnswerRe: Want to read and write to video memory to process the display of the monitor Pin
normanS13-Oct-05 19:54
normanS13-Oct-05 19:54 
GeneralRe: Want to read and write to video memory to process the display of the monitor Pin
dreammaker13-Oct-05 22:51
dreammaker13-Oct-05 22:51 
Questionwant help for Dialogbar Pin
vikas amin13-Oct-05 0:55
vikas amin13-Oct-05 0:55 
QuestionSelf Calling function Pin
benjnp13-Oct-05 0:53
benjnp13-Oct-05 0:53 
AnswerRe: Self Calling function Pin
Eytukan13-Oct-05 1:29
Eytukan13-Oct-05 1:29 
AnswerRe: Self Calling function Pin
Eytukan13-Oct-05 1:43
Eytukan13-Oct-05 1:43 
AnswerRe: Self Calling function Pin
Fired Fish13-Oct-05 1:46
Fired Fish13-Oct-05 1:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.