現在の最小、最大許容システム時刻を設定します。
#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetRange($hWnd, ByRef $aRange)
パラメータ
$hWnd | コントロールのハンドル |
$aRange | 次の形式の配列: [ 0] - 最小データを設定する場合True、それ以外の場合False [ 1] - 最小年 [ 2] - 最小月 [ 3] - 最小日 [ 4] - 最小時 [ 5] - 最小分 [ 6] - 最小秒 [ 7] - 最大データを設定する場合True、それ以外の場合False [ 8] - 最大Year [ 9] - 最大月 [10] - 最大日 [11] - 最大時 [12] - 最大分 [13] - 最大秒 |
返し値
成功: | True |
失敗: | False |
注意
なし。
関連
_GUICtrlDTP_GetRange
例
#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, $aRange[14] = [True, @YEAR, 1, 1, 21, 45, 32, True, @YEAR, 12, 31, 23, 59, 59]
_Main()
Func _Main()
Local $hDTP
; GUIを作成
GUICreate("DateTimePick Set Range", 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_SetRange($hDTP, $aRange)
; 日付け範囲を表示
$aRange = _GUICtrlDTP_GetRange($hDTP)
MemoWrite("Minimum date: " & GetDateStr(0))
MemoWrite("Maximum date: " & GetDateStr(7))
MemoWrite("Minimum time: " & GetTimeStr(4))
MemoWrite("Maximum time: " & GetTimeStr(11))
; ユーザーが終了するまでループ
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
; 日付け部分を返す
Func GetDateStr($iOff = 0)
Return StringFormat("%02d/%02d/%04d", $aRange[$iOff + 2], $aRange[$iOff + 3], $aRange[$iOff + 1])
EndFunc ;==>GetDateStr
; 時刻部分を返す
Func GetTimeStr($iOff = 0)
Return StringFormat("%02d:%02d:%02d", $aRange[$iOff], $aRange[$iOff + 1], $aRange[$iOff + 2])
EndFunc ;==>GetTimeStr
; メモコントロールに1行書き込み
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite