09-25-2023, 02:31 AM
The problem is the custom format.
DTM_SETFORMAT is used to set the format not the actual date or time.
for that you need to use DTM_SETSYSTEMTIME
here is working example
Function Function57
DTM_SETFORMAT is used to set the format not the actual date or time.
for that you need to use DTM_SETSYSTEMTIME
here is working example
Function Function57
def DTM_SETSYSTEMTIME 0x00001002
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;4 SysDateTimePick32 0x56030009 0x0 120 16 96 15 ""
;3 SysDateTimePick32 0x56030001 0x0 16 16 96 15 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""
DateTime t1 t2 dt
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,t1.FromComputerTime(); t1.AddParts(1); t1.AddMonths(1)
,SYSTEMTIME st1 st2
,st1=t1.ToSYSTEMTIME()
,st2=t1.ToSYSTEMTIME
,SendMessage(id(3 hDlg) DTM_SETFORMAT 0 "yy'-'MM'-'dd")
,SendMessage(id(3 hDlg) DTM_SETSYSTEMTIME GDT_VALID &st1)
,SendMessage(id(4 hDlg) DTM_SETFORMAT 0 "H':'mm")
,SendMessage(id(4 hDlg) DTM_SETSYSTEMTIME GDT_VALID &st2)
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.code
,case DTN_DATETIMECHANGE
,NMDATETIMECHANGE* p=+nh
,if p.dwFlags=GDT_VALID
,,dt.FromSYSTEMTIME(p.st)
,,out dt.ToStr
,else out "empty"