タスクバーの設定状態を取得          <TOP>


SHAppBarMessage タスクバーの位置及び設定状態を取得


 

 

 

XGAの場合
 

 

'================================================================
'= タスクバーの設定状態を取得
'=    (SHAppBarMessage.bas)
'================================================================
#include "Windows.bi"

#define ABS_AUTOHIDE &H1
#define ABS_ONTOP &H2
#define ABM_GETSTATE &H4
#define ABM_GETTASKBARPOS &H5

Type RECT
    Left   As Long
    Top    As Long
    Right  As Long
    Bottom As Long
End Type

Type APPBARDATA
    cbSize As Long
    hwnd   As Long
    uCallbackMessage As Long
    uEdge  As Long
    rc     As RECT
    lParam As Long
End Type

Declare Function Api_SHAppBarMessage& Lib "shell32" Alias "SHAppBarMessage" (ByVal dwMessage&, pData As APPBARDATA)

Var Shared Text1 As Object
Var Shared Check1 As Object
Var Shared Check2 As Object
Var Shared Button1 As Object

Text1.Attach GetDlgItem("Text1") : Text1.SetFontSize 14
Check1.Attach GetDlgItem("Check1") : Check1.SetFontSize 14
Check2.Attach GetDlgItem("Check2") : Check2.SetFontSize 14
Button1.Attach GetDlgItem("Button1") : Button1.SetFontSize 14

'================================================================
'=
'================================================================
Declare Sub Button1_on edecl ()
Sub Button1_on()
	Var ABD As APPBARDATA
	Var Ret As Long

	Ret = Api_SHAppBarMessage(ABM_GETTASKBARPOS, ABD)			'タスクバーの座標を取得
	Ret = Api_SHAppBarMessage(ABM_GETSTATE, ABD)				'タスクバーの状態を取得

    If (Ret and ABS_AUTOHIDE) Then Check1.SetCheck 1 else Check1.SetCheck 0
	If (Ret and ABS_ONTOP) Then Check2.SetCheck 1 else Check2.SetCheck 0
    Text1.SetWindowText "タスクバーの座標: (" + Trim$(Str$(ABD.rc.Left)) + "," + Trim$(Str$(ABD.rc.Top)) + ")-(" + Trim$(Str$(ABD.rc.Right)) + "," + Trim$(Str$(ABD.rc.Bottom)) + ")"
End Sub

'================================================================
'=
'================================================================
While 1
	WaitEvent
Wend
Stop
End