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子コントロールの DC。
prcRECT*inoptional描画する領域。この四角形は子ウィンドウの座標で指定します。このパラメーターが NULL の場合、描画する領域は子コントロールが占める領域全体になります。

戻り値の型: HRESULT

公式ドキュメント

部分的に透明、またはアルファ ブレンドされた子コントロールによって覆われている親コントロールの部分を描画します。

戻り値

型: HRESULT

この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラー コードを返します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// 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)。
const std = @import("std");

extern "uxtheme" fn DrawThemeParentBackground(
    hwnd: ?*anyopaque, // HWND
    hdc: ?*anyopaque, // HDC
    prc: [*c]RECT // RECT* optional
) callconv(std.os.windows.WINAPI) i32;
proc DrawThemeParentBackground(
    hwnd: pointer,  # HWND
    hdc: pointer,  # HDC
    prc: ptr RECT  # RECT* optional
): int32 {.importc: "DrawThemeParentBackground", stdcall, dynlib: "UXTHEME.dll".}
pragma(lib, "uxtheme");
extern(Windows)
int DrawThemeParentBackground(
    void* hwnd,   // HWND
    void* hdc,   // HDC
    RECT* prc   // RECT* optional
);
ccall((:DrawThemeParentBackground, "UXTHEME.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{RECT}),
      hwnd, hdc, prc)
# hwnd : HWND -> Ptr{Cvoid}
# hdc : HDC -> Ptr{Cvoid}
# prc : RECT* optional -> Ptr{RECT}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t DrawThemeParentBackground(
    void* hwnd,
    void* hdc,
    void* prc);
]]
local uxtheme = ffi.load("uxtheme")
-- uxtheme.DrawThemeParentBackground(hwnd, hdc, prc)
-- hwnd : HWND
-- hdc : HDC
-- prc : RECT* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UXTHEME.dll');
const DrawThemeParentBackground = lib.func('__stdcall', 'DrawThemeParentBackground', 'int32_t', ['void *', 'void *', 'void *']);
// DrawThemeParentBackground(hwnd, hdc, prc)
// hwnd : HWND -> 'void *'
// hdc : HDC -> 'void *'
// prc : RECT* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UXTHEME.dll", {
  DrawThemeParentBackground: { parameters: ["pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.DrawThemeParentBackground(hwnd, hdc, prc)
// hwnd : HWND -> "pointer"
// hdc : HDC -> "pointer"
// prc : RECT* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t DrawThemeParentBackground(
    void* hwnd,
    void* hdc,
    void* prc);
C, "UXTHEME.dll");
// $ffi->DrawThemeParentBackground(hwnd, hdc, prc);
// hwnd : HWND
// hdc : HDC
// prc : RECT* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Uxtheme extends StdCallLibrary {
    Uxtheme INSTANCE = Native.load("uxtheme", Uxtheme.class);
    int DrawThemeParentBackground(
        Pointer hwnd,   // HWND
        Pointer hdc,   // HDC
        Pointer prc   // RECT* optional
    );
}
@[Link("uxtheme")]
lib LibUXTHEME
  fun DrawThemeParentBackground = DrawThemeParentBackground(
    hwnd : Void*,   # HWND
    hdc : Void*,   # HDC
    prc : RECT*   # RECT* optional
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DrawThemeParentBackgroundNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef DrawThemeParentBackgroundDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final DrawThemeParentBackground = DynamicLibrary.open('UXTHEME.dll')
    .lookupFunction<DrawThemeParentBackgroundNative, DrawThemeParentBackgroundDart>('DrawThemeParentBackground');
// hwnd : HWND -> Pointer<Void>
// hdc : HDC -> Pointer<Void>
// prc : RECT* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DrawThemeParentBackground(
  hwnd: THandle;   // HWND
  hdc: THandle;   // HDC
  prc: Pointer   // RECT* optional
): Integer; stdcall;
  external 'UXTHEME.dll' name 'DrawThemeParentBackground';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DrawThemeParentBackground"
  c_DrawThemeParentBackground :: Ptr () -> Ptr () -> Ptr () -> IO Int32
-- hwnd : HWND -> Ptr ()
-- hdc : HDC -> Ptr ()
-- prc : RECT* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let drawthemeparentbackground =
  foreign "DrawThemeParentBackground"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* hwnd : HWND -> (ptr void) *)
(* hdc : HDC -> (ptr void) *)
(* prc : RECT* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library uxtheme (t "UXTHEME.dll"))
(cffi:use-foreign-library uxtheme)

(cffi:defcfun ("DrawThemeParentBackground" draw-theme-parent-background :convention :stdcall) :int32
  (hwnd :pointer)   ; HWND
  (hdc :pointer)   ; HDC
  (prc :pointer))   ; RECT* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DrawThemeParentBackground = Win32::API::More->new('UXTHEME',
    'int DrawThemeParentBackground(HANDLE hwnd, HANDLE hdc, LPVOID prc)');
# my $ret = $DrawThemeParentBackground->Call($hwnd, $hdc, $prc);
# hwnd : HWND -> HANDLE
# hdc : HDC -> HANDLE
# prc : RECT* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API
使用する型