コンボボックスのドロップダウンリスト座標 <TOP>
SendMessage 指定のウィンドウにメッセージを送る
CB_GETDROPPEDCONTROLRECT(&H152)
コンボボックスのドロップダウンリストボックスの長方形を取得する
CB_SHOWDROPDOWN(&H14F)
コンボボックスのリストボックスの表示または非表示を切り替える
'================================================================ '= コンボボックスのドロップダウンリスト座標 '= (CB_GETDROPPEDCONTROLRECT.bas) '================================================================ #include "Windows.bi" Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type ' ウィンドウにメッセージを送信 Declare Function Api_SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hWnd&, ByVal wMsg&, ByVal wParam&, lParam As Any) #define CB_GETDROPPEDCONTROLRECT &H152 'コンボボックスのドロップダウンリストボックスの長方形を取得する #define CB_SHOWDROPDOWN &H14F 'コンボボックスのリストボックスの表示または非表示を切り替える Var Shared Combo1 As Object Var Shared Text1 As Object Var Shared Button1 As Object Combo1.Attach GetDlgItem("Combo1") : Combo1.SetFontSize 12 Text1.Attach GetDlgItem("Text1") : Text1.SetFontSize 12 Button1.Attach GetDlgItem("Button1") : Button1.SetFontSize 12 '================================================================ '= '================================================================ Declare Sub MainForm_Start edecl () Sub MainForm_Start() Var mm(11) As String Var Ret As Long For i = 0 To 11 Read mm(i) Combo1.AddString mm(i) Next 'コンボボックスドロップダウン表示 SetMousePointer 0 Ret = Api_SendMessage(Combo1.GethWnd, CB_SHOWDROPDOWN, 1, ByVal 0) Data "January ", "February", "March", "April", "May", "June" Data "July", "August", "September", "October", "November", "December" End Sub '================================================================ '= '================================================================ Declare Sub Button1_on edecl () Sub Button1_on() Var rct As RECT Var Ret As Long ' コンボボックスのドロップダウンリスト座標を取得 Ret = Api_SendMessage(Combo1.GethWnd, CB_GETDROPPEDCONTROLRECT, CLng(0), rct) '結果を表示 Text1.SetWindowText "(" & Trim$(Str$(rct.Left)) & "," & Trim$(Str$(rct.Top)) & ")-" & "(" & Trim$(Str$(rct.Right)) & "," & Trim$(Str$(rct.Bottom)) & ")" End Sub '================================================================ '= '================================================================ While 1 WaitEvent Wend Stop End