Use User32 Type( T_SYSTEMTIME ) :: stSysDate iHandle = SendDlgItemMessage( hDlg , IDC_DATETIMEPICKER1 , DTM_GETSYSTEMTIME , 0 , Loc(stSysDate) )