CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2013
    Location
    Prague / Cracow
    Posts
    47

    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.

    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

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Getting date to SYSTEMTIME from DATETIMEPICK_CLASS control

    Quote Originally Posted by berkov View Post
    Microsoft does not say anything about this. They only say how to create or modify the DTPicker.
    Microsoft does say about Using Date and Time Picker Controls in MSDN.
    What you need is reading about How to Process Date and Time Picker Notifications
    And the notification you currently need to is DTN_DATETIMECHANGE
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Getting date to SYSTEMTIME from DATETIMEPICK_CLASS control

    Best regards,
    Igor

  4. #4
    Join Date
    Apr 2013
    Location
    Prague / Cracow
    Posts
    47

    Re: Getting date to SYSTEMTIME from DATETIMEPICK_CLASS control

    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;

    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured