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

IsDlgButtonChecked

関数
ダイアログ内ボタンのチェック状態を取得する。
DLLUSER32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD IsDlgButtonChecked(
    HWND hDlg,
    INT nIDButton
);

パラメーター

名前方向
hDlgHWNDin
nIDButtonINTin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

IsDlgButtonChecked = ctypes.windll.user32.IsDlgButtonChecked
IsDlgButtonChecked.restype = wintypes.DWORD
IsDlgButtonChecked.argtypes = [
    wintypes.HANDLE,  # hDlg : HWND
    ctypes.c_int,  # nIDButton : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procIsDlgButtonChecked = user32.NewProc("IsDlgButtonChecked")
)

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