現在選択されている日付けと時刻を設定します。
#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetSystemTime($hWnd, ByRef $aDate)
パラメータ
$hWnd | コントロールのハンドル |
$aDate | 次の形式の配列: [0] - Trueの場合、コントロールに"日付けなし"が設定されます。 [1] - 年 [2] - 月 [3] - 日 [4] - 時 [5] - 分 [6] - 秒 |
返し値
成功: | True |
失敗: | False |
注意
なし。
関連
_GUICtrlDTP_GetSystemTime
例
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>
Opt('MustDeclareVars', 1)
$Debug_DTP = False ; DTP関数に渡されるClassNameを調べる。動作を確認するにはTrueを設定し、他のコントロールのハンドルを使用
Global $iMemo, $tRange, $aDate
_Main()
Func _Main()
Local $hDTP, $a_Date[7] = [False, @YEAR, 8, 19, 21, 57, 34]
; GUIを作成
GUICreate("DateTimePick Set System Time", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
; 表示形式を設定
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")
; システム時刻を設定
_GUICtrlDTP_SetSystemTime($hDTP, $a_Date)
; システム時刻を表示
$aDate = _GUICtrlDTP_GetSystemTime($hDTP)
MemoWrite("Current date: " & GetDateStr())
MemoWrite("Current time: " & GetTimeStr())
; ユーザーが終了するまでループ
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
; 日付け部分を返す
Func GetDateStr()
Return StringFormat("%02d/%02d/%04d", $aDate[1], $aDate[2], $aDate[0])
EndFunc ;==>GetDateStr
; 時刻部分を返す
Func GetTimeStr()
Return StringFormat("%02d:%02d:%02d", $aDate[3], $aDate[4], $aDate[5])
EndFunc ;==>GetTimeStr
; メモコントロールに1行書き込み
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite