キャレットのブリンクタイム設定 <TOP>
SetCaretBlinkTime ブリンクタイム設定
GetCaretBlinkTime ブリンクタイム取得
ブリンクタイムを入力(単位ミリ秒)し、『変更』ボタンをクリックします。
カーソルの点滅速度を確認してください。『×』クリックで元の点滅時間に戻しています。

初期状態(図参照)では、800という値でした。

'================================================================ '= ブリンクタイムの設定
'= (SetCaretBlinkTime.bas)
'================================================================
#include "Windows.bi"
' キャレットの点滅時間を設定
Declare Function Api_SetCaretBlinkTime& Lib "user32" Alias "SetCaretBlinkTime" (ByVal wMSeconds&)
' キャレットのブリンク時間を取得する
Declare Function Api_GetCaretBlinkTime& Lib "user32" Alias "GetCaretBlinkTime" ()
Var Shared Edit1 As Object
Var Shared OldBT As Long
'================================================================
'=
'================================================================
Declare Sub Mainform_Start edecl ()
Sub Mainform_Start()
OldBT = Api_GetCaretBlinkTime '元のブリンクタイムを取得保持
Edit1.Attach GetDlgItem("Edit1")
Edit1.SetWindowText Trim$(Str$(OldBT))
Edit1.SetFocus
End Sub
'================================================================
'=
'================================================================
Declare Sub Button1_on edecl ()
Sub Button1_on()
Var NewBT As Integer
Var Ret As Long
NewBT = val(GetDlgItemText("Edit1")) '単位ミリ秒
Ret = Api_SetCaretBlinkTime(NewBT) 'Newブリンクタイム設定
Edit1.SetFocus
End Sub
'================================================================
'=
'================================================================
Declare Sub Mainform_QueryClose edecl (Cancel%, Mode%)
Sub Mainform_QueryClose(Cancel%, Mode%)
Var Ret As Long
If Cancel% = 0 Then
Ret = Api_SetCaretBlinkTime(OldBT) '元のブリンクタイムに戻す
End
End If
End Sub
'================================================================
'=
'================================================================
While 1
WaitEvent
Wend
Stop
End