ホーム › UI.Controls › HitTestThemeBackground
HitTestThemeBackground
関数テーマ背景に対する指定座標のヒットテストを行いコードを返す。
シグネチャ
// UXTHEME.dll
#include <windows.h>
HRESULT HitTestThemeBackground(
HTHEME hTheme,
HDC hdc, // optional
INT iPartId,
INT iStateId,
HIT_TEST_BACKGROUND_OPTIONS dwOptions,
RECT* pRect,
HRGN hrgn, // optional
POINT ptTest,
WORD* pwHitTestCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hTheme | HTHEME | in | ウィンドウに指定されたテーマデータへのハンドル。HTHEME を作成するには OpenThemeData を使用します。 |
| hdc | HDC | inoptional | 描画時に使用する HDC。このパラメーターには NULL を設定できます。 |
| iPartId | INT | in | パーツを指定する int 型の値。Parts and States を参照してください。 |
| iStateId | INT | in | パーツの状態を指定する int 型の値。Parts and States を参照してください。 |
| dwOptions | HIT_TEST_BACKGROUND_OPTIONS | in | ヒットテストオプションを指定する DWORD。オプションの一覧については Hit Test Options を参照してください。 |
| pRect | RECT* | in | 背景を囲む四角形を論理座標で格納する RECT 構造体へのポインター。 |
| hrgn | HRGN | inoptional | ヒットテスト領域の境界を指定するために使用できるリージョンへのハンドル。このパラメーターには NULL を設定できます。 |
| ptTest | POINT | in | 点の座標を格納する POINT 構造体。 |
| pwHitTestCode | WORD* | out | ptTest の点が pRect または hrgn で囲まれた背景領域内にあるかどうかを示すヒットテストコードを受け取る WORD。返される値の一覧については Hit Test Return Values を参照してください。 |
戻り値の型: HRESULT
公式ドキュメント
ビジュアルスタイルで指定された背景内の点に対するヒットテストコードを取得します。
戻り値
解説(Remarks)
ptTest と pRect の値は、クライアント座標やスクリーン座標など、同じ座標系で指定する必要があります。hrgn パラメーターを使用する場合は、pRect および ptTest と同じ座標系で指定する必要があります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// UXTHEME.dll
#include <windows.h>
HRESULT HitTestThemeBackground(
HTHEME hTheme,
HDC hdc, // optional
INT iPartId,
INT iStateId,
HIT_TEST_BACKGROUND_OPTIONS dwOptions,
RECT* pRect,
HRGN hrgn, // optional
POINT ptTest,
WORD* pwHitTestCode
);[DllImport("UXTHEME.dll", ExactSpelling = true)]
static extern int HitTestThemeBackground(
IntPtr hTheme, // HTHEME
IntPtr hdc, // HDC optional
int iPartId, // INT
int iStateId, // INT
uint dwOptions, // HIT_TEST_BACKGROUND_OPTIONS
IntPtr pRect, // RECT*
IntPtr hrgn, // HRGN optional
POINT ptTest, // POINT
out ushort pwHitTestCode // WORD* out
);<DllImport("UXTHEME.dll", ExactSpelling:=True)>
Public Shared Function HitTestThemeBackground(
hTheme As IntPtr, ' HTHEME
hdc As IntPtr, ' HDC optional
iPartId As Integer, ' INT
iStateId As Integer, ' INT
dwOptions As UInteger, ' HIT_TEST_BACKGROUND_OPTIONS
pRect As IntPtr, ' RECT*
hrgn As IntPtr, ' HRGN optional
ptTest As POINT, ' POINT
<Out> ByRef pwHitTestCode As UShort ' WORD* out
) As Integer
End Function' hTheme : HTHEME
' hdc : HDC optional
' iPartId : INT
' iStateId : INT
' dwOptions : HIT_TEST_BACKGROUND_OPTIONS
' pRect : RECT*
' hrgn : HRGN optional
' ptTest : POINT
' pwHitTestCode : WORD* out
Declare PtrSafe Function HitTestThemeBackground Lib "uxtheme" ( _
ByVal hTheme As LongPtr, _
ByVal hdc As LongPtr, _
ByVal iPartId As Long, _
ByVal iStateId As Long, _
ByVal dwOptions As Long, _
ByVal pRect As LongPtr, _
ByVal hrgn As LongPtr, _
ByVal ptTest As LongPtr, _
ByRef pwHitTestCode As Integer) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HitTestThemeBackground = ctypes.windll.uxtheme.HitTestThemeBackground
HitTestThemeBackground.restype = ctypes.c_int
HitTestThemeBackground.argtypes = [
ctypes.c_ssize_t, # hTheme : HTHEME
wintypes.HANDLE, # hdc : HDC optional
ctypes.c_int, # iPartId : INT
ctypes.c_int, # iStateId : INT
wintypes.DWORD, # dwOptions : HIT_TEST_BACKGROUND_OPTIONS
ctypes.c_void_p, # pRect : RECT*
wintypes.HANDLE, # hrgn : HRGN optional
POINT, # ptTest : POINT
ctypes.POINTER(ctypes.c_ushort), # pwHitTestCode : WORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UXTHEME.dll')
HitTestThemeBackground = Fiddle::Function.new(
lib['HitTestThemeBackground'],
[
Fiddle::TYPE_INTPTR_T, # hTheme : HTHEME
Fiddle::TYPE_VOIDP, # hdc : HDC optional
Fiddle::TYPE_INT, # iPartId : INT
Fiddle::TYPE_INT, # iStateId : INT
-Fiddle::TYPE_INT, # dwOptions : HIT_TEST_BACKGROUND_OPTIONS
Fiddle::TYPE_VOIDP, # pRect : RECT*
Fiddle::TYPE_VOIDP, # hrgn : HRGN optional
Fiddle::TYPE_VOIDP, # ptTest : POINT
Fiddle::TYPE_VOIDP, # pwHitTestCode : WORD* out
],
Fiddle::TYPE_INT)#[link(name = "uxtheme")]
extern "system" {
fn HitTestThemeBackground(
hTheme: isize, // HTHEME
hdc: *mut core::ffi::c_void, // HDC optional
iPartId: i32, // INT
iStateId: i32, // INT
dwOptions: u32, // HIT_TEST_BACKGROUND_OPTIONS
pRect: *mut RECT, // RECT*
hrgn: *mut core::ffi::c_void, // HRGN optional
ptTest: POINT, // POINT
pwHitTestCode: *mut u16 // WORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("UXTHEME.dll")]
public static extern int HitTestThemeBackground(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, uint dwOptions, IntPtr pRect, IntPtr hrgn, POINT ptTest, out ushort pwHitTestCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UXTHEME_HitTestThemeBackground' -Namespace Win32 -PassThru
# $api::HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode)#uselib "UXTHEME.dll"
#func global HitTestThemeBackground "HitTestThemeBackground" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; HitTestThemeBackground hTheme, hdc, iPartId, iStateId, dwOptions, varptr(pRect), hrgn, ptTest, varptr(pwHitTestCode) ; 戻り値は stat
; hTheme : HTHEME -> "sptr"
; hdc : HDC optional -> "sptr"
; iPartId : INT -> "sptr"
; iStateId : INT -> "sptr"
; dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> "sptr"
; pRect : RECT* -> "sptr"
; hrgn : HRGN optional -> "sptr"
; ptTest : POINT -> "sptr"
; pwHitTestCode : WORD* out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "UXTHEME.dll" #cfunc global HitTestThemeBackground "HitTestThemeBackground" sptr, sptr, int, int, int, var, sptr, int, var ; res = HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode) ; hTheme : HTHEME -> "sptr" ; hdc : HDC optional -> "sptr" ; iPartId : INT -> "int" ; iStateId : INT -> "int" ; dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> "int" ; pRect : RECT* -> "var" ; hrgn : HRGN optional -> "sptr" ; ptTest : POINT -> "int" ; pwHitTestCode : WORD* out -> "var" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "UXTHEME.dll" #cfunc global HitTestThemeBackground "HitTestThemeBackground" sptr, sptr, int, int, int, sptr, sptr, int, sptr ; res = HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, varptr(pRect), hrgn, ptTest, varptr(pwHitTestCode)) ; hTheme : HTHEME -> "sptr" ; hdc : HDC optional -> "sptr" ; iPartId : INT -> "int" ; iStateId : INT -> "int" ; dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> "int" ; pRect : RECT* -> "sptr" ; hrgn : HRGN optional -> "sptr" ; ptTest : POINT -> "int" ; pwHitTestCode : WORD* out -> "sptr" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT HitTestThemeBackground(HTHEME hTheme, HDC hdc, INT iPartId, INT iStateId, HIT_TEST_BACKGROUND_OPTIONS dwOptions, RECT* pRect, HRGN hrgn, POINT ptTest, WORD* pwHitTestCode) #uselib "UXTHEME.dll" #cfunc global HitTestThemeBackground "HitTestThemeBackground" intptr, intptr, int, int, int, var, intptr, int, var ; res = HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode) ; hTheme : HTHEME -> "intptr" ; hdc : HDC optional -> "intptr" ; iPartId : INT -> "int" ; iStateId : INT -> "int" ; dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> "int" ; pRect : RECT* -> "var" ; hrgn : HRGN optional -> "intptr" ; ptTest : POINT -> "int" ; pwHitTestCode : WORD* out -> "var" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT HitTestThemeBackground(HTHEME hTheme, HDC hdc, INT iPartId, INT iStateId, HIT_TEST_BACKGROUND_OPTIONS dwOptions, RECT* pRect, HRGN hrgn, POINT ptTest, WORD* pwHitTestCode) #uselib "UXTHEME.dll" #cfunc global HitTestThemeBackground "HitTestThemeBackground" intptr, intptr, int, int, int, intptr, intptr, int, intptr ; res = HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, varptr(pRect), hrgn, ptTest, varptr(pwHitTestCode)) ; hTheme : HTHEME -> "intptr" ; hdc : HDC optional -> "intptr" ; iPartId : INT -> "int" ; iStateId : INT -> "int" ; dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> "int" ; pRect : RECT* -> "intptr" ; hrgn : HRGN optional -> "intptr" ; ptTest : POINT -> "int" ; pwHitTestCode : WORD* out -> "intptr" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uxtheme = windows.NewLazySystemDLL("UXTHEME.dll")
procHitTestThemeBackground = uxtheme.NewProc("HitTestThemeBackground")
)
// hTheme (HTHEME), hdc (HDC optional), iPartId (INT), iStateId (INT), dwOptions (HIT_TEST_BACKGROUND_OPTIONS), pRect (RECT*), hrgn (HRGN optional), ptTest (POINT), pwHitTestCode (WORD* out)
r1, _, err := procHitTestThemeBackground.Call(
uintptr(hTheme),
uintptr(hdc),
uintptr(iPartId),
uintptr(iStateId),
uintptr(dwOptions),
uintptr(pRect),
uintptr(hrgn),
uintptr(ptTest),
uintptr(pwHitTestCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HitTestThemeBackground(
hTheme: NativeInt; // HTHEME
hdc: THandle; // HDC optional
iPartId: Integer; // INT
iStateId: Integer; // INT
dwOptions: DWORD; // HIT_TEST_BACKGROUND_OPTIONS
pRect: Pointer; // RECT*
hrgn: THandle; // HRGN optional
ptTest: POINT; // POINT
pwHitTestCode: Pointer // WORD* out
): Integer; stdcall;
external 'UXTHEME.dll' name 'HitTestThemeBackground';result := DllCall("UXTHEME\HitTestThemeBackground"
, "Ptr", hTheme ; HTHEME
, "Ptr", hdc ; HDC optional
, "Int", iPartId ; INT
, "Int", iStateId ; INT
, "UInt", dwOptions ; HIT_TEST_BACKGROUND_OPTIONS
, "Ptr", pRect ; RECT*
, "Ptr", hrgn ; HRGN optional
, "Ptr", ptTest ; POINT
, "Ptr", pwHitTestCode ; WORD* out
, "Int") ; return: HRESULT●HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode) = DLL("UXTHEME.dll", "int HitTestThemeBackground(int, void*, int, int, dword, void*, void*, void*, void*)")
# 呼び出し: HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode)
# hTheme : HTHEME -> "int"
# hdc : HDC optional -> "void*"
# iPartId : INT -> "int"
# iStateId : INT -> "int"
# dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> "dword"
# pRect : RECT* -> "void*"
# hrgn : HRGN optional -> "void*"
# ptTest : POINT -> "void*"
# pwHitTestCode : WORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "uxtheme" fn HitTestThemeBackground(
hTheme: isize, // HTHEME
hdc: ?*anyopaque, // HDC optional
iPartId: i32, // INT
iStateId: i32, // INT
dwOptions: u32, // HIT_TEST_BACKGROUND_OPTIONS
pRect: [*c]RECT, // RECT*
hrgn: ?*anyopaque, // HRGN optional
ptTest: POINT, // POINT
pwHitTestCode: [*c]u16 // WORD* out
) callconv(std.os.windows.WINAPI) i32;proc HitTestThemeBackground(
hTheme: int, # HTHEME
hdc: pointer, # HDC optional
iPartId: int32, # INT
iStateId: int32, # INT
dwOptions: uint32, # HIT_TEST_BACKGROUND_OPTIONS
pRect: ptr RECT, # RECT*
hrgn: pointer, # HRGN optional
ptTest: POINT, # POINT
pwHitTestCode: ptr uint16 # WORD* out
): int32 {.importc: "HitTestThemeBackground", stdcall, dynlib: "UXTHEME.dll".}pragma(lib, "uxtheme");
extern(Windows)
int HitTestThemeBackground(
ptrdiff_t hTheme, // HTHEME
void* hdc, // HDC optional
int iPartId, // INT
int iStateId, // INT
uint dwOptions, // HIT_TEST_BACKGROUND_OPTIONS
RECT* pRect, // RECT*
void* hrgn, // HRGN optional
POINT ptTest, // POINT
ushort* pwHitTestCode // WORD* out
);ccall((:HitTestThemeBackground, "UXTHEME.dll"), stdcall, Int32,
(Int, Ptr{Cvoid}, Int32, Int32, UInt32, Ptr{RECT}, Ptr{Cvoid}, POINT, Ptr{UInt16}),
hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode)
# hTheme : HTHEME -> Int
# hdc : HDC optional -> Ptr{Cvoid}
# iPartId : INT -> Int32
# iStateId : INT -> Int32
# dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> UInt32
# pRect : RECT* -> Ptr{RECT}
# hrgn : HRGN optional -> Ptr{Cvoid}
# ptTest : POINT -> POINT
# pwHitTestCode : WORD* out -> Ptr{UInt16}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t HitTestThemeBackground(
intptr_t hTheme,
void* hdc,
int32_t iPartId,
int32_t iStateId,
uint32_t dwOptions,
void* pRect,
void* hrgn,
POINT ptTest,
uint16_t* pwHitTestCode);
]]
local uxtheme = ffi.load("uxtheme")
-- uxtheme.HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode)
-- hTheme : HTHEME
-- hdc : HDC optional
-- iPartId : INT
-- iStateId : INT
-- dwOptions : HIT_TEST_BACKGROUND_OPTIONS
-- pRect : RECT*
-- hrgn : HRGN optional
-- ptTest : POINT
-- pwHitTestCode : WORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('UXTHEME.dll');
const HitTestThemeBackground = lib.func('__stdcall', 'HitTestThemeBackground', 'int32_t', ['intptr_t', 'void *', 'int32_t', 'int32_t', 'uint32_t', 'void *', 'void *', 'POINT', 'uint16_t *']);
// HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode)
// hTheme : HTHEME -> 'intptr_t'
// hdc : HDC optional -> 'void *'
// iPartId : INT -> 'int32_t'
// iStateId : INT -> 'int32_t'
// dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> 'uint32_t'
// pRect : RECT* -> 'void *'
// hrgn : HRGN optional -> 'void *'
// ptTest : POINT -> 'POINT'
// pwHitTestCode : WORD* out -> 'uint16_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("UXTHEME.dll", {
HitTestThemeBackground: { parameters: ["isize", "pointer", "i32", "i32", "u32", "pointer", "pointer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode)
// hTheme : HTHEME -> "isize"
// hdc : HDC optional -> "pointer"
// iPartId : INT -> "i32"
// iStateId : INT -> "i32"
// dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> "u32"
// pRect : RECT* -> "pointer"
// hrgn : HRGN optional -> "pointer"
// ptTest : POINT -> "buffer"
// pwHitTestCode : WORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t HitTestThemeBackground(
intptr_t hTheme,
void* hdc,
int32_t iPartId,
int32_t iStateId,
uint32_t dwOptions,
void* pRect,
void* hrgn,
POINT ptTest,
uint16_t* pwHitTestCode);
C, "UXTHEME.dll");
// $ffi->HitTestThemeBackground(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode);
// hTheme : HTHEME
// hdc : HDC optional
// iPartId : INT
// iStateId : INT
// dwOptions : HIT_TEST_BACKGROUND_OPTIONS
// pRect : RECT*
// hrgn : HRGN optional
// ptTest : POINT
// pwHitTestCode : WORD* 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 HitTestThemeBackground(
long hTheme, // HTHEME
Pointer hdc, // HDC optional
int iPartId, // INT
int iStateId, // INT
int dwOptions, // HIT_TEST_BACKGROUND_OPTIONS
Pointer pRect, // RECT*
Pointer hrgn, // HRGN optional
POINT /* extends Structure (by value) */ ptTest, // POINT
ShortByReference pwHitTestCode // WORD* out
);
}@[Link("uxtheme")]
lib LibUXTHEME
fun HitTestThemeBackground = HitTestThemeBackground(
hTheme : LibC::SSizeT, # HTHEME
hdc : Void*, # HDC optional
iPartId : Int32, # INT
iStateId : Int32, # INT
dwOptions : UInt32, # HIT_TEST_BACKGROUND_OPTIONS
pRect : RECT*, # RECT*
hrgn : Void*, # HRGN optional
ptTest : POINT, # POINT
pwHitTestCode : UInt16* # WORD* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef HitTestThemeBackgroundNative = Int32 Function(IntPtr, Pointer<Void>, Int32, Int32, Uint32, Pointer<Void>, Pointer<Void>, POINT, Pointer<Uint16>);
typedef HitTestThemeBackgroundDart = int Function(int, Pointer<Void>, int, int, int, Pointer<Void>, Pointer<Void>, int, Pointer<Uint16>);
final HitTestThemeBackground = DynamicLibrary.open('UXTHEME.dll')
.lookupFunction<HitTestThemeBackgroundNative, HitTestThemeBackgroundDart>('HitTestThemeBackground');
// hTheme : HTHEME -> IntPtr
// hdc : HDC optional -> Pointer<Void>
// iPartId : INT -> Int32
// iStateId : INT -> Int32
// dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> Uint32
// pRect : RECT* -> Pointer<Void>
// hrgn : HRGN optional -> Pointer<Void>
// ptTest : POINT -> POINT
// pwHitTestCode : WORD* out -> Pointer<Uint16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function HitTestThemeBackground(
hTheme: NativeInt; // HTHEME
hdc: THandle; // HDC optional
iPartId: Integer; // INT
iStateId: Integer; // INT
dwOptions: DWORD; // HIT_TEST_BACKGROUND_OPTIONS
pRect: Pointer; // RECT*
hrgn: THandle; // HRGN optional
ptTest: POINT; // POINT
pwHitTestCode: Pointer // WORD* out
): Integer; stdcall;
external 'UXTHEME.dll' name 'HitTestThemeBackground';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "HitTestThemeBackground"
c_HitTestThemeBackground :: CIntPtr -> Ptr () -> Int32 -> Int32 -> Word32 -> Ptr () -> Ptr () -> POINT -> Ptr Word16 -> IO Int32
-- hTheme : HTHEME -> CIntPtr
-- hdc : HDC optional -> Ptr ()
-- iPartId : INT -> Int32
-- iStateId : INT -> Int32
-- dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> Word32
-- pRect : RECT* -> Ptr ()
-- hrgn : HRGN optional -> Ptr ()
-- ptTest : POINT -> POINT
-- pwHitTestCode : WORD* out -> Ptr Word16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。open Ctypes
open Foreign
let hittestthemebackground =
foreign "HitTestThemeBackground"
(intptr_t @-> (ptr void) @-> int32_t @-> int32_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> POINT @-> (ptr uint16_t) @-> returning int32_t)
(* hTheme : HTHEME -> intptr_t *)
(* hdc : HDC optional -> (ptr void) *)
(* iPartId : INT -> int32_t *)
(* iStateId : INT -> int32_t *)
(* dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> uint32_t *)
(* pRect : RECT* -> (ptr void) *)
(* hrgn : HRGN optional -> (ptr void) *)
(* ptTest : POINT -> POINT *)
(* pwHitTestCode : WORD* out -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library uxtheme (t "UXTHEME.dll"))
(cffi:use-foreign-library uxtheme)
(cffi:defcfun ("HitTestThemeBackground" hit-test-theme-background :convention :stdcall) :int32
(h-theme :int64) ; HTHEME
(hdc :pointer) ; HDC optional
(i-part-id :int32) ; INT
(i-state-id :int32) ; INT
(dw-options :uint32) ; HIT_TEST_BACKGROUND_OPTIONS
(p-rect :pointer) ; RECT*
(hrgn :pointer) ; HRGN optional
(pt-test (:struct point)) ; POINT
(pw-hit-test-code :pointer)) ; WORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $HitTestThemeBackground = Win32::API::More->new('UXTHEME',
'int HitTestThemeBackground(LPARAM hTheme, HANDLE hdc, int iPartId, int iStateId, DWORD dwOptions, LPVOID pRect, HANDLE hrgn, LPVOID ptTest, LPVOID pwHitTestCode)');
# my $ret = $HitTestThemeBackground->Call($hTheme, $hdc, $iPartId, $iStateId, $dwOptions, $pRect, $hrgn, $ptTest, $pwHitTestCode);
# hTheme : HTHEME -> LPARAM
# hdc : HDC optional -> HANDLE
# iPartId : INT -> int
# iStateId : INT -> int
# dwOptions : HIT_TEST_BACKGROUND_OPTIONS -> DWORD
# pRect : RECT* -> LPVOID
# hrgn : HRGN optional -> HANDLE
# ptTest : POINT -> LPVOID
# pwHitTestCode : WORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。