ホーム › UI.Controls › GetComboBoxInfo
GetComboBoxInfo
関数コンボボックスの内部構成情報を取得する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL GetComboBoxInfo(
HWND hwndCombo,
COMBOBOXINFO* pcbi
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwndCombo | HWND | in |
| pcbi | COMBOBOXINFO* | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL GetComboBoxInfo(
HWND hwndCombo,
COMBOBOXINFO* pcbi
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetComboBoxInfo(
IntPtr hwndCombo, // HWND
IntPtr pcbi // COMBOBOXINFO* in/out
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetComboBoxInfo(
hwndCombo As IntPtr, ' HWND
pcbi As IntPtr ' COMBOBOXINFO* in/out
) As Boolean
End Function' hwndCombo : HWND
' pcbi : COMBOBOXINFO* in/out
Declare PtrSafe Function GetComboBoxInfo Lib "user32" ( _
ByVal hwndCombo As LongPtr, _
ByVal pcbi As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetComboBoxInfo = ctypes.windll.user32.GetComboBoxInfo
GetComboBoxInfo.restype = wintypes.BOOL
GetComboBoxInfo.argtypes = [
wintypes.HANDLE, # hwndCombo : HWND
ctypes.c_void_p, # pcbi : COMBOBOXINFO* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
GetComboBoxInfo = Fiddle::Function.new(
lib['GetComboBoxInfo'],
[
Fiddle::TYPE_VOIDP, # hwndCombo : HWND
Fiddle::TYPE_VOIDP, # pcbi : COMBOBOXINFO* in/out
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn GetComboBoxInfo(
hwndCombo: *mut core::ffi::c_void, // HWND
pcbi: *mut COMBOBOXINFO // COMBOBOXINFO* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true)]
public static extern bool GetComboBoxInfo(IntPtr hwndCombo, IntPtr pcbi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetComboBoxInfo' -Namespace Win32 -PassThru
# $api::GetComboBoxInfo(hwndCombo, pcbi)#uselib "USER32.dll"
#func global GetComboBoxInfo "GetComboBoxInfo" sptr, sptr
; GetComboBoxInfo hwndCombo, varptr(pcbi) ; 戻り値は stat
; hwndCombo : HWND -> "sptr"
; pcbi : COMBOBOXINFO* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global GetComboBoxInfo "GetComboBoxInfo" sptr, var ; res = GetComboBoxInfo(hwndCombo, pcbi) ; hwndCombo : HWND -> "sptr" ; pcbi : COMBOBOXINFO* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global GetComboBoxInfo "GetComboBoxInfo" sptr, sptr ; res = GetComboBoxInfo(hwndCombo, varptr(pcbi)) ; hwndCombo : HWND -> "sptr" ; pcbi : COMBOBOXINFO* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetComboBoxInfo(HWND hwndCombo, COMBOBOXINFO* pcbi) #uselib "USER32.dll" #cfunc global GetComboBoxInfo "GetComboBoxInfo" intptr, var ; res = GetComboBoxInfo(hwndCombo, pcbi) ; hwndCombo : HWND -> "intptr" ; pcbi : COMBOBOXINFO* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetComboBoxInfo(HWND hwndCombo, COMBOBOXINFO* pcbi) #uselib "USER32.dll" #cfunc global GetComboBoxInfo "GetComboBoxInfo" intptr, intptr ; res = GetComboBoxInfo(hwndCombo, varptr(pcbi)) ; hwndCombo : HWND -> "intptr" ; pcbi : COMBOBOXINFO* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procGetComboBoxInfo = user32.NewProc("GetComboBoxInfo")
)
// hwndCombo (HWND), pcbi (COMBOBOXINFO* in/out)
r1, _, err := procGetComboBoxInfo.Call(
uintptr(hwndCombo),
uintptr(pcbi),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetComboBoxInfo(
hwndCombo: THandle; // HWND
pcbi: Pointer // COMBOBOXINFO* in/out
): BOOL; stdcall;
external 'USER32.dll' name 'GetComboBoxInfo';result := DllCall("USER32\GetComboBoxInfo"
, "Ptr", hwndCombo ; HWND
, "Ptr", pcbi ; COMBOBOXINFO* in/out
, "Int") ; return: BOOL●GetComboBoxInfo(hwndCombo, pcbi) = DLL("USER32.dll", "bool GetComboBoxInfo(void*, void*)")
# 呼び出し: GetComboBoxInfo(hwndCombo, pcbi)
# hwndCombo : HWND -> "void*"
# pcbi : COMBOBOXINFO* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。