Dear All!

I am programming an application, which have a date time picker control. I want to set a value(SYSTEMTIME) for a datetime picker control, and this value I get from other dialog by Month View Calendar. This is the function I tried to use but it dit not run:

invoke SendMessage,hDateTimePicker,DTM_SETSYSTEMTIME,GDT_VALID,addr selectedTime

selectedTime is a SYSTEMTIME variable I got from Month View Calendar. I want that when I selected a day from Month View Calendar, it will open another dialog which has a datetime picker control with the date is the date I selected.

Thank you very much!
Posted on 2004-08-25 21:17:04 by kakashi
Hi kakashi,

you could try to set the DateTimePicker control with

.data
datestring db "27.08.2004",0
.code
SetDlgItemText,hWin,ID_DATETIMEPICKER,addr datestring

I appended some demo code from GoofyGeek productions.
Conversion from SYSTEMTIME is straightforward.

Hope this helps

fxcb
Posted on 2004-08-27 08:52:22 by fxcb
Thank for your reply!
But I know that you wrong.
I read it in masm8.2 example. A date time picker control can not be SetDlgItemText. You can just only GetDlgItemText to get the content of the text shown on the control and pass it into a buffer. I try did many times.
What you see in that example is just it show the current day not a different day.
The problem why I want to use a date time control is I want to input a variable systemtime and it will show out in longdateformat for example : "Tyesday , August 10 , 2004" and beside that I can select other day. So I don't want to set a text.
Anyway thank for your reply!

Why do Iczelion not have any tutorial about month view control or date time picker control???? :?
Posted on 2004-08-28 03:16:02 by kakashi
kakashi,

In the Example8 subfolder of the MASM32 installation you will find an
application I wrote quite a while ago called JACTS:
Joe's Alarm clock/Countdown Timer/Stopwatch
It uses a DateTimePicker as one of the controls to set an alarm time.
The following are a few things to check:
InitCommonControlsEx or InitCommonControls is required to use the control,
check the return from that invoke! What is your return value?
My DTM_SETSYSTEMTIME looks like yours except I use NULL instead of GDT_VALID

Check the return values of your calls and let us know what the values are,
I'll be glad to help you!

Welcome!!

farrier




include \masm32\include\comctl32.inc ;For DateTimePicker
includelib \masm32\lib\comctl32.lib


.data
DateFormat db "hh':'mm' 'tt' 'ddd' 'dd' 'MMMM' 'yyyy", 0 ;Format for Time/Date in DateTimePicker
.data?
icex INITCOMMONCONTROLSEX <> ;structure for DateTimePicker

.code
mov icex.dwSize, sizeof INITCOMMONCONTROLSEX
;prepare common control structure
mov icex.dwICC, ICC_DATE_CLASSES or ICC_BAR_CLASSES or ICC_WIN95_CLASSES
invoke InitCommonControlsEx, addr icex
;initialize common controls for DateTimePicker


invoke SendMessage, sdc_handle, DTM_SETFORMAT, NULL, addr DateFormat
;set format of DateTime control to string in DateFormat

invoke GetLocalTime, addr system_time
;Get current time
add system_time.wMinute, 1
;add 1 to minutes
invoke SendMessage, sdc_handle, DTM_SETSYSTEMTIME, NULL, addr system_time
;set the control time to this updated time

invoke SendMessage, sdc_handle, DTM_GETSYSTEMTIME, 0, addr system_time
;get the date time from that control
Posted on 2004-08-28 16:26:51 by farrier
Thank you very much! :-D :idea:
Posted on 2004-09-04 10:59:10 by kakashi