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

DwmEnableBlurBehindWindow

関数
ウィンドウ背後のぼかし効果を有効化または設定する。
DLLdwmapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT DwmEnableBlurBehindWindow(
    HWND hWnd,
    const DWM_BLURBEHIND* pBlurBehind
);

パラメーター

名前方向
hWndHWNDin
pBlurBehindDWM_BLURBEHIND*in

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DwmEnableBlurBehindWindow(
    HWND hWnd,
    const DWM_BLURBEHIND* pBlurBehind
);
[DllImport("dwmapi.dll", ExactSpelling = true)]
static extern int DwmEnableBlurBehindWindow(
    IntPtr hWnd,   // HWND
    IntPtr pBlurBehind   // DWM_BLURBEHIND*
);
<DllImport("dwmapi.dll", ExactSpelling:=True)>
Public Shared Function DwmEnableBlurBehindWindow(
    hWnd As IntPtr,   ' HWND
    pBlurBehind As IntPtr   ' DWM_BLURBEHIND*
) As Integer
End Function
' hWnd : HWND
' pBlurBehind : DWM_BLURBEHIND*
Declare PtrSafe Function DwmEnableBlurBehindWindow Lib "dwmapi" ( _
    ByVal hWnd As LongPtr, _
    ByVal pBlurBehind As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DwmEnableBlurBehindWindow = ctypes.windll.dwmapi.DwmEnableBlurBehindWindow
DwmEnableBlurBehindWindow.restype = ctypes.c_int
DwmEnableBlurBehindWindow.argtypes = [
    wintypes.HANDLE,  # hWnd : HWND
    ctypes.c_void_p,  # pBlurBehind : DWM_BLURBEHIND*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dwmapi.dll')
DwmEnableBlurBehindWindow = Fiddle::Function.new(
  lib['DwmEnableBlurBehindWindow'],
  [
    Fiddle::TYPE_VOIDP,  # hWnd : HWND
    Fiddle::TYPE_VOIDP,  # pBlurBehind : DWM_BLURBEHIND*
  ],
  Fiddle::TYPE_INT)
#[link(name = "dwmapi")]
extern "system" {
    fn DwmEnableBlurBehindWindow(
        hWnd: *mut core::ffi::c_void,  // HWND
        pBlurBehind: *const DWM_BLURBEHIND  // DWM_BLURBEHIND*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("dwmapi.dll")]
public static extern int DwmEnableBlurBehindWindow(IntPtr hWnd, IntPtr pBlurBehind);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dwmapi_DwmEnableBlurBehindWindow' -Namespace Win32 -PassThru
# $api::DwmEnableBlurBehindWindow(hWnd, pBlurBehind)
#uselib "dwmapi.dll"
#func global DwmEnableBlurBehindWindow "DwmEnableBlurBehindWindow" sptr, sptr
; DwmEnableBlurBehindWindow hWnd, varptr(pBlurBehind)   ; 戻り値は stat
; hWnd : HWND -> "sptr"
; pBlurBehind : DWM_BLURBEHIND* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "dwmapi.dll"
#cfunc global DwmEnableBlurBehindWindow "DwmEnableBlurBehindWindow" sptr, var
; res = DwmEnableBlurBehindWindow(hWnd, pBlurBehind)
; hWnd : HWND -> "sptr"
; pBlurBehind : DWM_BLURBEHIND* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT DwmEnableBlurBehindWindow(HWND hWnd, DWM_BLURBEHIND* pBlurBehind)
#uselib "dwmapi.dll"
#cfunc global DwmEnableBlurBehindWindow "DwmEnableBlurBehindWindow" intptr, var
; res = DwmEnableBlurBehindWindow(hWnd, pBlurBehind)
; hWnd : HWND -> "intptr"
; pBlurBehind : DWM_BLURBEHIND* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dwmapi = windows.NewLazySystemDLL("dwmapi.dll")
	procDwmEnableBlurBehindWindow = dwmapi.NewProc("DwmEnableBlurBehindWindow")
)

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