Win32 API 日本語リファレンス
ホームUI.Controls › GetListBoxInfo

GetListBoxInfo

関数
リストボックスの1列あたりの項目数情報を取得する。
DLLUSER32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// USER32.dll
#include <windows.h>

DWORD GetListBoxInfo(
    HWND hwnd
);

パラメーター

名前方向
hwndHWNDin

戻り値の型: DWORD

各言語での呼び出し定義

// USER32.dll
#include <windows.h>

DWORD GetListBoxInfo(
    HWND hwnd
);
[DllImport("USER32.dll", ExactSpelling = true)]
static extern uint GetListBoxInfo(
    IntPtr hwnd   // HWND
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function GetListBoxInfo(
    hwnd As IntPtr   ' HWND
) As UInteger
End Function
' hwnd : HWND
Declare PtrSafe Function GetListBoxInfo Lib "user32" ( _
    ByVal hwnd As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetListBoxInfo = ctypes.windll.user32.GetListBoxInfo
GetListBoxInfo.restype = wintypes.DWORD
GetListBoxInfo.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
GetListBoxInfo = Fiddle::Function.new(
  lib['GetListBoxInfo'],
  [
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
  ],
  -Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn GetListBoxInfo(
        hwnd: *mut core::ffi::c_void  // HWND
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USER32.dll")]
public static extern uint GetListBoxInfo(IntPtr hwnd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetListBoxInfo' -Namespace Win32 -PassThru
# $api::GetListBoxInfo(hwnd)
#uselib "USER32.dll"
#func global GetListBoxInfo "GetListBoxInfo" sptr
; GetListBoxInfo hwnd   ; 戻り値は stat
; hwnd : HWND -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global GetListBoxInfo "GetListBoxInfo" sptr
; res = GetListBoxInfo(hwnd)
; hwnd : HWND -> "sptr"
; DWORD GetListBoxInfo(HWND hwnd)
#uselib "USER32.dll"
#cfunc global GetListBoxInfo "GetListBoxInfo" intptr
; res = GetListBoxInfo(hwnd)
; hwnd : HWND -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procGetListBoxInfo = user32.NewProc("GetListBoxInfo")
)

// hwnd (HWND)
r1, _, err := procGetListBoxInfo.Call(
	uintptr(hwnd),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function GetListBoxInfo(
  hwnd: THandle   // HWND
): DWORD; stdcall;
  external 'USER32.dll' name 'GetListBoxInfo';
result := DllCall("USER32\GetListBoxInfo"
    , "Ptr", hwnd   ; HWND
    , "UInt")   ; return: DWORD
●GetListBoxInfo(hwnd) = DLL("USER32.dll", "dword GetListBoxInfo(void*)")
# 呼び出し: GetListBoxInfo(hwnd)
# hwnd : HWND -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。