Private Sub Form_Load()
Dim cc As tagINITCOMMONCONTROLSEX
Dim PanePos(2) As Long
cc.dwSize = Len(cc)
cc.dwICC = ICC_BAR_CLASSES
hStatusWnd = CreateStatusWindow(WS_VISIBLE Or WS_CHILD Or _
CCS_BOTTOM Or SBARS_SIZEGRIP, _
"ステータスウィンドウのサンプル", Me.hWnd, 0)
PanePos(0) = 200
PanePos(1) = 300
PanePos(2) = -1
Call SendMessageAny(hStatusWnd, SB_SETPARTS, 3, PanePos(0))
Call SendMessageStr(hStatusWnd, SB_SETTEXT, 1, "x:0 y:0")
Call SendMessageStr(hStatusWnd, SB_SETTEXT, 2, "キャプション")
Me.Timer1.Enabled = True
Me.Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Dim Pos As PointApi, hWnd As Long
Dim Temp As String, cch As Long
Call GetCursorPos(Pos)
Call SendMessageStr(hStatusWnd, SB_SETTEXT, 1, _
"x" + Str(Pos.X) + " y" + Str(Pos.Y))
hWnd = WindowFromPoint(Pos.X, Pos.Y)
cch = GetWindowTextLength(hWnd)
cch = cch * 2
Temp = String(cch, Chr(0))
Call GetWindowText(hWnd, Temp, Len(Temp))
Call SendMessageStr(hStatusWnd, SB_SETTEXT, 2, MidB(Temp, 1, cch))
End Sub