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

IsDialogMessageW

関数
メッセージがダイアログ用か判定し処理する(Unicode版)。
DLLUSER32.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// USER32.dll  (Unicode / -W)
#include <windows.h>

BOOL IsDialogMessageW(
    HWND hDlg,
    MSG* lpMsg
);

パラメーター

名前方向
hDlgHWNDin
lpMsgMSG*in

戻り値の型: BOOL

各言語での呼び出し定義

// USER32.dll  (Unicode / -W)
#include <windows.h>

BOOL IsDialogMessageW(
    HWND hDlg,
    MSG* lpMsg
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool IsDialogMessageW(
    IntPtr hDlg,   // HWND
    IntPtr lpMsg   // MSG*
);
<DllImport("USER32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function IsDialogMessageW(
    hDlg As IntPtr,   ' HWND
    lpMsg As IntPtr   ' MSG*
) As Boolean
End Function
' hDlg : HWND
' lpMsg : MSG*
Declare PtrSafe Function IsDialogMessageW Lib "user32" ( _
    ByVal hDlg As LongPtr, _
    ByVal lpMsg As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

IsDialogMessageW = ctypes.windll.user32.IsDialogMessageW
IsDialogMessageW.restype = wintypes.BOOL
IsDialogMessageW.argtypes = [
    wintypes.HANDLE,  # hDlg : HWND
    ctypes.c_void_p,  # lpMsg : MSG*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
IsDialogMessageW = Fiddle::Function.new(
  lib['IsDialogMessageW'],
  [
    Fiddle::TYPE_VOIDP,  # hDlg : HWND
    Fiddle::TYPE_VOIDP,  # lpMsg : MSG*
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "user32")]
extern "system" {
    fn IsDialogMessageW(
        hDlg: *mut core::ffi::c_void,  // HWND
        lpMsg: *mut MSG  // MSG*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", CharSet = CharSet.Unicode)]
public static extern bool IsDialogMessageW(IntPtr hDlg, IntPtr lpMsg);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_IsDialogMessageW' -Namespace Win32 -PassThru
# $api::IsDialogMessageW(hDlg, lpMsg)
#uselib "USER32.dll"
#func global IsDialogMessageW "IsDialogMessageW" wptr, wptr
; IsDialogMessageW hDlg, varptr(lpMsg)   ; 戻り値は stat
; hDlg : HWND -> "wptr"
; lpMsg : MSG* -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USER32.dll"
#cfunc global IsDialogMessageW "IsDialogMessageW" sptr, var
; res = IsDialogMessageW(hDlg, lpMsg)
; hDlg : HWND -> "sptr"
; lpMsg : MSG* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL IsDialogMessageW(HWND hDlg, MSG* lpMsg)
#uselib "USER32.dll"
#cfunc global IsDialogMessageW "IsDialogMessageW" intptr, var
; res = IsDialogMessageW(hDlg, lpMsg)
; hDlg : HWND -> "intptr"
; lpMsg : MSG* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procIsDialogMessageW = user32.NewProc("IsDialogMessageW")
)

// hDlg (HWND), lpMsg (MSG*)
r1, _, err := procIsDialogMessageW.Call(
	uintptr(hDlg),
	uintptr(lpMsg),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function IsDialogMessageW(
  hDlg: THandle;   // HWND
  lpMsg: Pointer   // MSG*
): BOOL; stdcall;
  external 'USER32.dll' name 'IsDialogMessageW';
result := DllCall("USER32\IsDialogMessageW"
    , "Ptr", hDlg   ; HWND
    , "Ptr", lpMsg   ; MSG*
    , "Int")   ; return: BOOL
●IsDialogMessageW(hDlg, lpMsg) = DLL("USER32.dll", "bool IsDialogMessageW(void*, void*)")
# 呼び出し: IsDialogMessageW(hDlg, lpMsg)
# hDlg : HWND -> "void*"
# lpMsg : MSG* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。