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

DrawThemeParentBackground

関数
子コントロールの位置に親ウィンドウの背景を描画する。
DLLUXTHEME.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT DrawThemeParentBackground(
    HWND hwnd,
    HDC hdc,
    const RECT* prc   // optional
);

パラメーター

名前方向
hwndHWNDin
hdcHDCin
prcRECT*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

DrawThemeParentBackground = ctypes.windll.uxtheme.DrawThemeParentBackground
DrawThemeParentBackground.restype = ctypes.c_int
DrawThemeParentBackground.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
    wintypes.HANDLE,  # hdc : HDC
    ctypes.c_void_p,  # prc : RECT* optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uxtheme = windows.NewLazySystemDLL("UXTHEME.dll")
	procDrawThemeParentBackground = uxtheme.NewProc("DrawThemeParentBackground")
)

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