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

DrawThemeEdge

関数
テーマに従って矩形のエッジ(枠線)を描画する。
DLLUXTHEME.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT DrawThemeEdge(
    HTHEME hTheme,
    HDC hdc,
    INT iPartId,
    INT iStateId,
    RECT* pDestRect,
    DRAWEDGE_FLAGS uEdge,
    DRAW_EDGE_FLAGS uFlags,
    RECT* pContentRect   // optional
);

パラメーター

名前方向説明
hThemeHTHEMEinウィンドウに指定されたテーマデータへのハンドルです。HTHEME を作成するには OpenThemeData を使用します。
hdcHDCinHDC です。
iPartIdINTin矩形を含むパーツを指定する int 型の値です。Parts and States を参照してください。
iStateIdINTinパーツの状態を指定する int 型の値です。Parts and States を参照してください。
pDestRectRECT*in矩形を論理座標で格納する RECT 構造体へのポインターです。
uEdgeDRAWEDGE_FLAGSin

描画する内側エッジおよび外側エッジの種類を指定する UINT です。このパラメーターは、1つの内側ボーダーフラグと1つの外側ボーダーフラグの組み合わせ、または組み合わせフラグの1つでなければなりません。ボーダーフラグは次のとおりです。

意味
BDR_RAISEDINNER
隆起した内側エッジ
BDR_SUNKENINNER
沈み込んだ内側エッジ
BDR_RAISEDOUTER
隆起した外側エッジ
BDR_SUNKENOUTER
沈み込んだ外側エッジ
EDGE_BUMP
BDR_RAISEDOUTERBDR_SUNKENINNER の組み合わせ
EDGE_ETCHED
BDR_SUNKENOUTERBDR_RAISEDINNER の組み合わせ
EDGE_RAISED
BDR_RAISEDOUTERBDR_RAISEDINNER の組み合わせ
EDGE_SUNKEN
BDR_SUNKENOUTERBDR_SUNKENINNER の組み合わせ
uFlagsDRAW_EDGE_FLAGSin

描画するボーダーの種類を指定する UINT です。このパラメーターには、次の値の組み合わせを指定できます。

意味
BF_ADJUST
pDestRect パラメーターが指す矩形は、描画されたエッジを除外するように縮小されます。指定しない場合、矩形は変化しません。
BF_BOTTOM
ボーダー矩形の下辺。
BF_BOTTOMLEFT
ボーダー矩形の下辺と左辺。
BF_BOTTOMRIGHT
ボーダー矩形の下辺と右辺。
BF_DIAGONAL
対角線のボーダー。
BF_DIAGONAL_ENDBOTTOMLEFT
対角線のボーダー。終点は矩形の左下隅、始点は右上隅です。
BF_DIAGONAL_ENDBOTTOMRIGHT
対角線のボーダー。終点は矩形の右下隅、始点は左上隅です。
BF_DIAGONAL_ENDTOPLEFT
対角線のボーダー。終点は矩形の左上隅、始点は右下隅です。
BF_DIAGONAL_ENDTOPRIGHT
対角線のボーダー。終点は矩形の右上隅、始点は左下隅です。
BF_FLAT
フラットなボーダー。
BF_LEFT
ボーダー矩形の左辺。
BF_MIDDLE
矩形の内部が塗りつぶされます。
BF_MONO
1次元のボーダー。
BF_RECT
ボーダー矩形全体。
BF_RIGHT
ボーダー矩形の右辺。
BF_SOFT
タイルではなくソフトボタン。
BF_TOP
ボーダー矩形の上辺。
BF_TOPLEFT
ボーダー矩形の上辺と左辺。
BF_TOPRIGHT
ボーダー矩形の上辺と右辺。
pContentRectRECT*outoptionaluFlagsBF_ADJUST が設定されている場合に、内側の矩形を受け取る矩形を論理座標で格納する RECT 構造体へのポインターです。このパラメーターには NULL を設定できます。

戻り値の型: HRESULT

公式ドキュメント

ビジュアルスタイルによって定義される、矩形の1つ以上のエッジを描画します。

戻り値

型: 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 DrawThemeEdge(
    HTHEME hTheme,
    HDC hdc,
    INT iPartId,
    INT iStateId,
    RECT* pDestRect,
    DRAWEDGE_FLAGS uEdge,
    DRAW_EDGE_FLAGS uFlags,
    RECT* pContentRect   // optional
);
[DllImport("UXTHEME.dll", ExactSpelling = true)]
static extern int DrawThemeEdge(
    IntPtr hTheme,   // HTHEME
    IntPtr hdc,   // HDC
    int iPartId,   // INT
    int iStateId,   // INT
    IntPtr pDestRect,   // RECT*
    uint uEdge,   // DRAWEDGE_FLAGS
    uint uFlags,   // DRAW_EDGE_FLAGS
    IntPtr pContentRect   // RECT* optional, out
);
<DllImport("UXTHEME.dll", ExactSpelling:=True)>
Public Shared Function DrawThemeEdge(
    hTheme As IntPtr,   ' HTHEME
    hdc As IntPtr,   ' HDC
    iPartId As Integer,   ' INT
    iStateId As Integer,   ' INT
    pDestRect As IntPtr,   ' RECT*
    uEdge As UInteger,   ' DRAWEDGE_FLAGS
    uFlags As UInteger,   ' DRAW_EDGE_FLAGS
    pContentRect As IntPtr   ' RECT* optional, out
) As Integer
End Function
' hTheme : HTHEME
' hdc : HDC
' iPartId : INT
' iStateId : INT
' pDestRect : RECT*
' uEdge : DRAWEDGE_FLAGS
' uFlags : DRAW_EDGE_FLAGS
' pContentRect : RECT* optional, out
Declare PtrSafe Function DrawThemeEdge Lib "uxtheme" ( _
    ByVal hTheme As LongPtr, _
    ByVal hdc As LongPtr, _
    ByVal iPartId As Long, _
    ByVal iStateId As Long, _
    ByVal pDestRect As LongPtr, _
    ByVal uEdge As Long, _
    ByVal uFlags As Long, _
    ByVal pContentRect As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DrawThemeEdge = ctypes.windll.uxtheme.DrawThemeEdge
DrawThemeEdge.restype = ctypes.c_int
DrawThemeEdge.argtypes = [
    ctypes.c_ssize_t,  # hTheme : HTHEME
    wintypes.HANDLE,  # hdc : HDC
    ctypes.c_int,  # iPartId : INT
    ctypes.c_int,  # iStateId : INT
    ctypes.c_void_p,  # pDestRect : RECT*
    wintypes.DWORD,  # uEdge : DRAWEDGE_FLAGS
    wintypes.DWORD,  # uFlags : DRAW_EDGE_FLAGS
    ctypes.c_void_p,  # pContentRect : RECT* optional, out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uxtheme = windows.NewLazySystemDLL("UXTHEME.dll")
	procDrawThemeEdge = uxtheme.NewProc("DrawThemeEdge")
)

// hTheme (HTHEME), hdc (HDC), iPartId (INT), iStateId (INT), pDestRect (RECT*), uEdge (DRAWEDGE_FLAGS), uFlags (DRAW_EDGE_FLAGS), pContentRect (RECT* optional, out)
r1, _, err := procDrawThemeEdge.Call(
	uintptr(hTheme),
	uintptr(hdc),
	uintptr(iPartId),
	uintptr(iStateId),
	uintptr(pDestRect),
	uintptr(uEdge),
	uintptr(uFlags),
	uintptr(pContentRect),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DrawThemeEdge(
  hTheme: NativeInt;   // HTHEME
  hdc: THandle;   // HDC
  iPartId: Integer;   // INT
  iStateId: Integer;   // INT
  pDestRect: Pointer;   // RECT*
  uEdge: DWORD;   // DRAWEDGE_FLAGS
  uFlags: DWORD;   // DRAW_EDGE_FLAGS
  pContentRect: Pointer   // RECT* optional, out
): Integer; stdcall;
  external 'UXTHEME.dll' name 'DrawThemeEdge';
result := DllCall("UXTHEME\DrawThemeEdge"
    , "Ptr", hTheme   ; HTHEME
    , "Ptr", hdc   ; HDC
    , "Int", iPartId   ; INT
    , "Int", iStateId   ; INT
    , "Ptr", pDestRect   ; RECT*
    , "UInt", uEdge   ; DRAWEDGE_FLAGS
    , "UInt", uFlags   ; DRAW_EDGE_FLAGS
    , "Ptr", pContentRect   ; RECT* optional, out
    , "Int")   ; return: HRESULT
●DrawThemeEdge(hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect) = DLL("UXTHEME.dll", "int DrawThemeEdge(int, void*, int, int, void*, dword, dword, void*)")
# 呼び出し: DrawThemeEdge(hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect)
# hTheme : HTHEME -> "int"
# hdc : HDC -> "void*"
# iPartId : INT -> "int"
# iStateId : INT -> "int"
# pDestRect : RECT* -> "void*"
# uEdge : DRAWEDGE_FLAGS -> "dword"
# uFlags : DRAW_EDGE_FLAGS -> "dword"
# pContentRect : RECT* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "uxtheme" fn DrawThemeEdge(
    hTheme: isize, // HTHEME
    hdc: ?*anyopaque, // HDC
    iPartId: i32, // INT
    iStateId: i32, // INT
    pDestRect: [*c]RECT, // RECT*
    uEdge: u32, // DRAWEDGE_FLAGS
    uFlags: u32, // DRAW_EDGE_FLAGS
    pContentRect: [*c]RECT // RECT* optional, out
) callconv(std.os.windows.WINAPI) i32;
proc DrawThemeEdge(
    hTheme: int,  # HTHEME
    hdc: pointer,  # HDC
    iPartId: int32,  # INT
    iStateId: int32,  # INT
    pDestRect: ptr RECT,  # RECT*
    uEdge: uint32,  # DRAWEDGE_FLAGS
    uFlags: uint32,  # DRAW_EDGE_FLAGS
    pContentRect: ptr RECT  # RECT* optional, out
): int32 {.importc: "DrawThemeEdge", stdcall, dynlib: "UXTHEME.dll".}
pragma(lib, "uxtheme");
extern(Windows)
int DrawThemeEdge(
    ptrdiff_t hTheme,   // HTHEME
    void* hdc,   // HDC
    int iPartId,   // INT
    int iStateId,   // INT
    RECT* pDestRect,   // RECT*
    uint uEdge,   // DRAWEDGE_FLAGS
    uint uFlags,   // DRAW_EDGE_FLAGS
    RECT* pContentRect   // RECT* optional, out
);
ccall((:DrawThemeEdge, "UXTHEME.dll"), stdcall, Int32,
      (Int, Ptr{Cvoid}, Int32, Int32, Ptr{RECT}, UInt32, UInt32, Ptr{RECT}),
      hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect)
# hTheme : HTHEME -> Int
# hdc : HDC -> Ptr{Cvoid}
# iPartId : INT -> Int32
# iStateId : INT -> Int32
# pDestRect : RECT* -> Ptr{RECT}
# uEdge : DRAWEDGE_FLAGS -> UInt32
# uFlags : DRAW_EDGE_FLAGS -> UInt32
# pContentRect : RECT* optional, out -> Ptr{RECT}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t DrawThemeEdge(
    intptr_t hTheme,
    void* hdc,
    int32_t iPartId,
    int32_t iStateId,
    void* pDestRect,
    uint32_t uEdge,
    uint32_t uFlags,
    void* pContentRect);
]]
local uxtheme = ffi.load("uxtheme")
-- uxtheme.DrawThemeEdge(hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect)
-- hTheme : HTHEME
-- hdc : HDC
-- iPartId : INT
-- iStateId : INT
-- pDestRect : RECT*
-- uEdge : DRAWEDGE_FLAGS
-- uFlags : DRAW_EDGE_FLAGS
-- pContentRect : RECT* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UXTHEME.dll');
const DrawThemeEdge = lib.func('__stdcall', 'DrawThemeEdge', 'int32_t', ['intptr_t', 'void *', 'int32_t', 'int32_t', 'void *', 'uint32_t', 'uint32_t', 'void *']);
// DrawThemeEdge(hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect)
// hTheme : HTHEME -> 'intptr_t'
// hdc : HDC -> 'void *'
// iPartId : INT -> 'int32_t'
// iStateId : INT -> 'int32_t'
// pDestRect : RECT* -> 'void *'
// uEdge : DRAWEDGE_FLAGS -> 'uint32_t'
// uFlags : DRAW_EDGE_FLAGS -> 'uint32_t'
// pContentRect : RECT* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UXTHEME.dll", {
  DrawThemeEdge: { parameters: ["isize", "pointer", "i32", "i32", "pointer", "u32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.DrawThemeEdge(hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect)
// hTheme : HTHEME -> "isize"
// hdc : HDC -> "pointer"
// iPartId : INT -> "i32"
// iStateId : INT -> "i32"
// pDestRect : RECT* -> "pointer"
// uEdge : DRAWEDGE_FLAGS -> "u32"
// uFlags : DRAW_EDGE_FLAGS -> "u32"
// pContentRect : RECT* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t DrawThemeEdge(
    intptr_t hTheme,
    void* hdc,
    int32_t iPartId,
    int32_t iStateId,
    void* pDestRect,
    uint32_t uEdge,
    uint32_t uFlags,
    void* pContentRect);
C, "UXTHEME.dll");
// $ffi->DrawThemeEdge(hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect);
// hTheme : HTHEME
// hdc : HDC
// iPartId : INT
// iStateId : INT
// pDestRect : RECT*
// uEdge : DRAWEDGE_FLAGS
// uFlags : DRAW_EDGE_FLAGS
// pContentRect : RECT* optional, out
// 構造体/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 DrawThemeEdge(
        long hTheme,   // HTHEME
        Pointer hdc,   // HDC
        int iPartId,   // INT
        int iStateId,   // INT
        Pointer pDestRect,   // RECT*
        int uEdge,   // DRAWEDGE_FLAGS
        int uFlags,   // DRAW_EDGE_FLAGS
        Pointer pContentRect   // RECT* optional, out
    );
}
@[Link("uxtheme")]
lib LibUXTHEME
  fun DrawThemeEdge = DrawThemeEdge(
    hTheme : LibC::SSizeT,   # HTHEME
    hdc : Void*,   # HDC
    iPartId : Int32,   # INT
    iStateId : Int32,   # INT
    pDestRect : RECT*,   # RECT*
    uEdge : UInt32,   # DRAWEDGE_FLAGS
    uFlags : UInt32,   # DRAW_EDGE_FLAGS
    pContentRect : RECT*   # RECT* optional, out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DrawThemeEdgeNative = Int32 Function(IntPtr, Pointer<Void>, Int32, Int32, Pointer<Void>, Uint32, Uint32, Pointer<Void>);
typedef DrawThemeEdgeDart = int Function(int, Pointer<Void>, int, int, Pointer<Void>, int, int, Pointer<Void>);
final DrawThemeEdge = DynamicLibrary.open('UXTHEME.dll')
    .lookupFunction<DrawThemeEdgeNative, DrawThemeEdgeDart>('DrawThemeEdge');
// hTheme : HTHEME -> IntPtr
// hdc : HDC -> Pointer<Void>
// iPartId : INT -> Int32
// iStateId : INT -> Int32
// pDestRect : RECT* -> Pointer<Void>
// uEdge : DRAWEDGE_FLAGS -> Uint32
// uFlags : DRAW_EDGE_FLAGS -> Uint32
// pContentRect : RECT* optional, out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DrawThemeEdge(
  hTheme: NativeInt;   // HTHEME
  hdc: THandle;   // HDC
  iPartId: Integer;   // INT
  iStateId: Integer;   // INT
  pDestRect: Pointer;   // RECT*
  uEdge: DWORD;   // DRAWEDGE_FLAGS
  uFlags: DWORD;   // DRAW_EDGE_FLAGS
  pContentRect: Pointer   // RECT* optional, out
): Integer; stdcall;
  external 'UXTHEME.dll' name 'DrawThemeEdge';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DrawThemeEdge"
  c_DrawThemeEdge :: CIntPtr -> Ptr () -> Int32 -> Int32 -> Ptr () -> Word32 -> Word32 -> Ptr () -> IO Int32
-- hTheme : HTHEME -> CIntPtr
-- hdc : HDC -> Ptr ()
-- iPartId : INT -> Int32
-- iStateId : INT -> Int32
-- pDestRect : RECT* -> Ptr ()
-- uEdge : DRAWEDGE_FLAGS -> Word32
-- uFlags : DRAW_EDGE_FLAGS -> Word32
-- pContentRect : RECT* optional, out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let drawthemeedge =
  foreign "DrawThemeEdge"
    (intptr_t @-> (ptr void) @-> int32_t @-> int32_t @-> (ptr void) @-> uint32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hTheme : HTHEME -> intptr_t *)
(* hdc : HDC -> (ptr void) *)
(* iPartId : INT -> int32_t *)
(* iStateId : INT -> int32_t *)
(* pDestRect : RECT* -> (ptr void) *)
(* uEdge : DRAWEDGE_FLAGS -> uint32_t *)
(* uFlags : DRAW_EDGE_FLAGS -> uint32_t *)
(* pContentRect : RECT* optional, out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library uxtheme (t "UXTHEME.dll"))
(cffi:use-foreign-library uxtheme)

(cffi:defcfun ("DrawThemeEdge" draw-theme-edge :convention :stdcall) :int32
  (h-theme :int64)   ; HTHEME
  (hdc :pointer)   ; HDC
  (i-part-id :int32)   ; INT
  (i-state-id :int32)   ; INT
  (p-dest-rect :pointer)   ; RECT*
  (u-edge :uint32)   ; DRAWEDGE_FLAGS
  (u-flags :uint32)   ; DRAW_EDGE_FLAGS
  (p-content-rect :pointer))   ; RECT* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DrawThemeEdge = Win32::API::More->new('UXTHEME',
    'int DrawThemeEdge(LPARAM hTheme, HANDLE hdc, int iPartId, int iStateId, LPVOID pDestRect, DWORD uEdge, DWORD uFlags, LPVOID pContentRect)');
# my $ret = $DrawThemeEdge->Call($hTheme, $hdc, $iPartId, $iStateId, $pDestRect, $uEdge, $uFlags, $pContentRect);
# hTheme : HTHEME -> LPARAM
# hdc : HDC -> HANDLE
# iPartId : INT -> int
# iStateId : INT -> int
# pDestRect : RECT* -> LPVOID
# uEdge : DRAWEDGE_FLAGS -> DWORD
# uFlags : DRAW_EDGE_FLAGS -> DWORD
# pContentRect : RECT* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型