Thread: How to read from date and time picker?

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    18

    How to read from date and time picker?

    Hi,

    How can I read from the date and time picker control? My DT picker is set to only show the time with the spin control. I need seperate data for the hour and minutes selected.
    I've read through the MSDN description but I'm too noob to understand it.

    http://msdn.microsoft.com/library/de...e/datetime.asp

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Something like the code below:
    Code:
    SYSTEMTIME st = { 0 };
    
    if (DateTime_GetSystemtime(hwndYourDateTimeControl, &st) == GDT_VALID)
    {
      // Hour selected is in st.wHour
      // Minute selected is in st.wMinute
    }

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    18
    Ah, thanks.

    Could you also tell me what would be the best way to set a timer of some sort to trigger an alarm at certain point? I've tried using the CreateWaitableTimer function but it locks up the program until it triggers.

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    If your program has a window, you can use the SetTimer function.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advancing day by day until it matches a second date
    By nhubred in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2009, 08:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  3. Sending an email in C program
    By Moony in forum C Programming
    Replies: 28
    Last Post: 10-19-2006, 10:42 AM
  4. How to read the date & time of a file?
    By megablue in forum C Programming
    Replies: 5
    Last Post: 11-03-2003, 11:58 PM