MainWndに配置したStatic、EditBox、CommandButtonなどに、マウスポインタが行った(クリックなどせずに、ただその領域内へ移動するだけ)時に其々の説明を例えばステ-タスバ-2に表示させたいのですが、
MainWnd_Create時に、
コード: 全て選択
GetClientRect(hStatic1, Static1_rc)
コード: 全て選択
GetCursorPos(PointerPos)
で、PointerPosを取得し、If条件文で(MainWnd_PosはMainWnd_Moveイベントで取得済み)
コード: 全て選択
If PointerPos.x >=MainWnd_Pos.x+30 and PointerPos.x <=MainWnd_Pos.x+30+Static1_rc.right _
and PointerPos.y >=MainWnd_Pos.y+15 and PointerPos.y <=MainWnd_Pos.y+15+Static1_rc.bottom _
Then
wsprintf(buffer, "Static1の説明")
ElseIf PointerPos.x >=MainWnd_Pos.x+18 and PointerPos.x <=MainWnd_Pos.x+24+EditBox1_rc.right _
and PointerPos.y >=MainWnd_Pos.y+58 and PointerPos.y <=MainWnd_Pos.y+64+EditBox1_rc.bottom _
Then
wsprintf(buffer, "EditBox1の説明")
ElseIf PointerPos.x >=MainWnd_Pos.x+478 and PointerPos.x <=MainWnd_Pos.x+481+CommandButton1_rc.right _
and PointerPos.y >=MainWnd_Pos.y+18 and PointerPos.y <=MainWnd_Pos.y+21+CommandButton1_rc.bottom _
Then
wsprintf(buffer, "CommandButton1の説明")
Else
wsprintf(buffer, "")
End If
(EditBox1はX=20、Y=60にあり、CommandButton1はX=480、Y=20にある場合で、其々の領域より少し大きくしないとダメなので端数にしている)
コード: 全て選択
SendMessage(hStatusWnd, SB_SETTEXT, 2, buffer)
また
コード: 全て選択
wsprintf(buffer, "Pointer Pos: x%d, y%d", PointerPos.x, PointerPos.y)
SetWindowText(hEditBox2, buffer)
マウスをゆっくりと動かすとステ-タスバ-2、EditBox2とも期待通りに表示されるので、プログラムは正常に動いていると思うのですが、マウスを少し速く移動させてEditBoxやCommandButtonに持っていくとStatic1以外は、EditBoxではポインタが"I"表示に変化したりして(CommandButtonでもOSが何かを掴むのか)、GetCursorPos(PointerPos)の位置取得が遅れて取りこぼしが出て、PointerPosが正確にEditBox2に表示しなくなり、If条件文に合わなくなってステ-タスバ-2にも表示しません。
(ポインタの移動速度や加速度は関係ありませんでした)
(1)マウスを速く移動させても位置取得遅れが出ない方法は?
(2)Static以外のEditBoxやCommandButtonなどでは、その領域にポインタが入るとPointerPos表示が止まり値が変化しません。
これらの領域に入っても位置を入手する方法は?
(3)ステ-タスバ-0、ステ-タスバ-1にポインタが行ってもその説明文をステ-タスバ-2へ出したいのですが、現状ではステ-タスバ-やタイトルバ-へ行くともう位置を入手しません。(ステ-タスバ-の作成はHelpにCreateStatusWindowの記述がないので、Win32プログラミング講座のStep21、22に倣った)
これらの領域に入っても位置を入手する方法は?
(4)GetCursorPos()以外でよい方法はありませんか?