Win32 API 日本語リファレンス
ホームGraphics.Dwm › DwmDefWindowProc

DwmDefWindowProc

関数
DWMが処理すべきウィンドウメッセージの既定処理を行う。
DLLdwmapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

BOOL DwmDefWindowProc(
    HWND hWnd,
    DWORD msg,
    WPARAM wParam,
    LPARAM lParam,
    LRESULT* plResult
);

パラメーター

名前方向
hWndHWNDin
msgDWORDin
wParamWPARAMin
lParamLPARAMin
plResultLRESULT*out

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL DwmDefWindowProc(
    HWND hWnd,
    DWORD msg,
    WPARAM wParam,
    LPARAM lParam,
    LRESULT* plResult
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dwmapi.dll", ExactSpelling = true)]
static extern bool DwmDefWindowProc(
    IntPtr hWnd,   // HWND
    uint msg,   // DWORD
    UIntPtr wParam,   // WPARAM
    IntPtr lParam,   // LPARAM
    out IntPtr plResult   // LRESULT* out
);
<DllImport("dwmapi.dll", ExactSpelling:=True)>
Public Shared Function DwmDefWindowProc(
    hWnd As IntPtr,   ' HWND
    msg As UInteger,   ' DWORD
    wParam As UIntPtr,   ' WPARAM
    lParam As IntPtr,   ' LPARAM
    <Out> ByRef plResult As IntPtr   ' LRESULT* out
) As Boolean
End Function
' hWnd : HWND
' msg : DWORD
' wParam : WPARAM
' lParam : LPARAM
' plResult : LRESULT* out
Declare PtrSafe Function DwmDefWindowProc Lib "dwmapi" ( _
    ByVal hWnd As LongPtr, _
    ByVal msg As Long, _
    ByVal wParam As LongPtr, _
    ByVal lParam As LongPtr, _
    ByRef plResult As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DwmDefWindowProc = ctypes.windll.dwmapi.DwmDefWindowProc
DwmDefWindowProc.restype = wintypes.BOOL
DwmDefWindowProc.argtypes = [
    wintypes.HANDLE,  # hWnd : HWND
    wintypes.DWORD,  # msg : DWORD
    ctypes.c_size_t,  # wParam : WPARAM
    ctypes.c_ssize_t,  # lParam : LPARAM
    ctypes.c_void_p,  # plResult : LRESULT* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dwmapi.dll')
DwmDefWindowProc = Fiddle::Function.new(
  lib['DwmDefWindowProc'],
  [
    Fiddle::TYPE_VOIDP,  # hWnd : HWND
    -Fiddle::TYPE_INT,  # msg : DWORD
    Fiddle::TYPE_UINTPTR_T,  # wParam : WPARAM
    Fiddle::TYPE_INTPTR_T,  # lParam : LPARAM
    Fiddle::TYPE_VOIDP,  # plResult : LRESULT* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "dwmapi")]
extern "system" {
    fn DwmDefWindowProc(
        hWnd: *mut core::ffi::c_void,  // HWND
        msg: u32,  // DWORD
        wParam: usize,  // WPARAM
        lParam: isize,  // LPARAM
        plResult: *mut isize  // LRESULT* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dwmapi.dll")]
public static extern bool DwmDefWindowProc(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam, out IntPtr plResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dwmapi_DwmDefWindowProc' -Namespace Win32 -PassThru
# $api::DwmDefWindowProc(hWnd, msg, wParam, lParam, plResult)
#uselib "dwmapi.dll"
#func global DwmDefWindowProc "DwmDefWindowProc" sptr, sptr, sptr, sptr, sptr
; DwmDefWindowProc hWnd, msg, wParam, lParam, plResult   ; 戻り値は stat
; hWnd : HWND -> "sptr"
; msg : DWORD -> "sptr"
; wParam : WPARAM -> "sptr"
; lParam : LPARAM -> "sptr"
; plResult : LRESULT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dwmapi.dll"
#cfunc global DwmDefWindowProc "DwmDefWindowProc" sptr, int, sptr, sptr, int
; res = DwmDefWindowProc(hWnd, msg, wParam, lParam, plResult)
; hWnd : HWND -> "sptr"
; msg : DWORD -> "int"
; wParam : WPARAM -> "sptr"
; lParam : LPARAM -> "sptr"
; plResult : LRESULT* out -> "int"
; BOOL DwmDefWindowProc(HWND hWnd, DWORD msg, WPARAM wParam, LPARAM lParam, LRESULT* plResult)
#uselib "dwmapi.dll"
#cfunc global DwmDefWindowProc "DwmDefWindowProc" intptr, int, intptr, intptr, int
; res = DwmDefWindowProc(hWnd, msg, wParam, lParam, plResult)
; hWnd : HWND -> "intptr"
; msg : DWORD -> "int"
; wParam : WPARAM -> "intptr"
; lParam : LPARAM -> "intptr"
; plResult : LRESULT* out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dwmapi = windows.NewLazySystemDLL("dwmapi.dll")
	procDwmDefWindowProc = dwmapi.NewProc("DwmDefWindowProc")
)

// hWnd (HWND), msg (DWORD), wParam (WPARAM), lParam (LPARAM), plResult (LRESULT* out)
r1, _, err := procDwmDefWindowProc.Call(
	uintptr(hWnd),
	uintptr(msg),
	uintptr(wParam),
	uintptr(lParam),
	uintptr(plResult),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function DwmDefWindowProc(
  hWnd: THandle;   // HWND
  msg: DWORD;   // DWORD
  wParam: NativeUInt;   // WPARAM
  lParam: NativeInt;   // LPARAM
  plResult: Pointer   // LRESULT* out
): BOOL; stdcall;
  external 'dwmapi.dll' name 'DwmDefWindowProc';
result := DllCall("dwmapi\DwmDefWindowProc"
    , "Ptr", hWnd   ; HWND
    , "UInt", msg   ; DWORD
    , "UPtr", wParam   ; WPARAM
    , "Ptr", lParam   ; LPARAM
    , "Ptr", plResult   ; LRESULT* out
    , "Int")   ; return: BOOL
●DwmDefWindowProc(hWnd, msg, wParam, lParam, plResult) = DLL("dwmapi.dll", "bool DwmDefWindowProc(void*, dword, int, int, void*)")
# 呼び出し: DwmDefWindowProc(hWnd, msg, wParam, lParam, plResult)
# hWnd : HWND -> "void*"
# msg : DWORD -> "dword"
# wParam : WPARAM -> "int"
# lParam : LPARAM -> "int"
# plResult : LRESULT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。