Getting date to SYSTEMTIME from DATETIMEPICK_CLASS control

Hey ho!

It's been more than a week since i got stuck with one small stupid thing and i cannot move forward with the code (WINAPI).

I've created a static dialog (IDD_FVT DIALOGEX 0, 0, 319, 200) with a control as follows:
CONTROL "", IDC_FVT_dwst, DATETIMEPICK_CLASS, WS_TABSTOP | DTS_RIGHTALIGN, 219, 25, 55, 13

What i need to do now is to let the user pick the date and when he/she clicks "save" i need to be able to use that date. By the following function i'm getting the handle to this control:
HWND FVT_dwst = GetDlgItem( hwnd, IDC_FVT_dwst )

Now, having HWND FVT_dwst, how can i use the date, how can i get it from that control and which format (structure) it would be so i can then use it in my program?
I believe it should be something like SYSTEMTIME but still don't know how to get it from that **** control.


I am really desperate so i'd be very grateful for any kind of hint.
Microsoft does not say anything about this. They only say how to create or modify the DTPicker.

thanks
berkov
You can send DTM_GETSYSTEMTIME message to the control and get time as SYSTEMTIME or use DateTime_GetSystemtime macro.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb761769(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/bb761801(v=vs.85).aspx
Works perfectly!


thanks a lot.

i guess i need to spend some more time on MSDN to work out how to use it better.

bool Control2Date(HWND control, SYSTEMTIME * target){
SendMessage(control, DTM_GETSYSTEMTIME, 0, (LPARAM) target);
return true;

}
Topic archived. No new replies allowed.