ホーム › Graphics.Dwm › DwmRegisterThumbnail
DwmRegisterThumbnail
関数ソースウィンドウのサムネイルを宛先ウィンドウに登録する。
シグネチャ
// dwmapi.dll
#include <windows.h>
HRESULT DwmRegisterThumbnail(
HWND hwndDestination,
HWND hwndSource,
INT_PTR* phThumbnailId
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwndDestination | HWND | in |
| hwndSource | HWND | in |
| phThumbnailId | INT_PTR* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// dwmapi.dll
#include <windows.h>
HRESULT DwmRegisterThumbnail(
HWND hwndDestination,
HWND hwndSource,
INT_PTR* phThumbnailId
);[DllImport("dwmapi.dll", ExactSpelling = true)]
static extern int DwmRegisterThumbnail(
IntPtr hwndDestination, // HWND
IntPtr hwndSource, // HWND
out IntPtr phThumbnailId // INT_PTR* out
);<DllImport("dwmapi.dll", ExactSpelling:=True)>
Public Shared Function DwmRegisterThumbnail(
hwndDestination As IntPtr, ' HWND
hwndSource As IntPtr, ' HWND
<Out> ByRef phThumbnailId As IntPtr ' INT_PTR* out
) As Integer
End Function' hwndDestination : HWND
' hwndSource : HWND
' phThumbnailId : INT_PTR* out
Declare PtrSafe Function DwmRegisterThumbnail Lib "dwmapi" ( _
ByVal hwndDestination As LongPtr, _
ByVal hwndSource As LongPtr, _
ByRef phThumbnailId As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DwmRegisterThumbnail = ctypes.windll.dwmapi.DwmRegisterThumbnail
DwmRegisterThumbnail.restype = ctypes.c_int
DwmRegisterThumbnail.argtypes = [
wintypes.HANDLE, # hwndDestination : HWND
wintypes.HANDLE, # hwndSource : HWND
ctypes.POINTER(ctypes.c_ssize_t), # phThumbnailId : INT_PTR* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dwmapi.dll')
DwmRegisterThumbnail = Fiddle::Function.new(
lib['DwmRegisterThumbnail'],
[
Fiddle::TYPE_VOIDP, # hwndDestination : HWND
Fiddle::TYPE_VOIDP, # hwndSource : HWND
Fiddle::TYPE_VOIDP, # phThumbnailId : INT_PTR* out
],
Fiddle::TYPE_INT)#[link(name = "dwmapi")]
extern "system" {
fn DwmRegisterThumbnail(
hwndDestination: *mut core::ffi::c_void, // HWND
hwndSource: *mut core::ffi::c_void, // HWND
phThumbnailId: *mut isize // INT_PTR* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dwmapi.dll")]
public static extern int DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out IntPtr phThumbnailId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dwmapi_DwmRegisterThumbnail' -Namespace Win32 -PassThru
# $api::DwmRegisterThumbnail(hwndDestination, hwndSource, phThumbnailId)#uselib "dwmapi.dll"
#func global DwmRegisterThumbnail "DwmRegisterThumbnail" sptr, sptr, sptr
; DwmRegisterThumbnail hwndDestination, hwndSource, varptr(phThumbnailId) ; 戻り値は stat
; hwndDestination : HWND -> "sptr"
; hwndSource : HWND -> "sptr"
; phThumbnailId : INT_PTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dwmapi.dll" #cfunc global DwmRegisterThumbnail "DwmRegisterThumbnail" sptr, sptr, var ; res = DwmRegisterThumbnail(hwndDestination, hwndSource, phThumbnailId) ; hwndDestination : HWND -> "sptr" ; hwndSource : HWND -> "sptr" ; phThumbnailId : INT_PTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dwmapi.dll" #cfunc global DwmRegisterThumbnail "DwmRegisterThumbnail" sptr, sptr, sptr ; res = DwmRegisterThumbnail(hwndDestination, hwndSource, varptr(phThumbnailId)) ; hwndDestination : HWND -> "sptr" ; hwndSource : HWND -> "sptr" ; phThumbnailId : INT_PTR* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DwmRegisterThumbnail(HWND hwndDestination, HWND hwndSource, INT_PTR* phThumbnailId) #uselib "dwmapi.dll" #cfunc global DwmRegisterThumbnail "DwmRegisterThumbnail" intptr, intptr, var ; res = DwmRegisterThumbnail(hwndDestination, hwndSource, phThumbnailId) ; hwndDestination : HWND -> "intptr" ; hwndSource : HWND -> "intptr" ; phThumbnailId : INT_PTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DwmRegisterThumbnail(HWND hwndDestination, HWND hwndSource, INT_PTR* phThumbnailId) #uselib "dwmapi.dll" #cfunc global DwmRegisterThumbnail "DwmRegisterThumbnail" intptr, intptr, intptr ; res = DwmRegisterThumbnail(hwndDestination, hwndSource, varptr(phThumbnailId)) ; hwndDestination : HWND -> "intptr" ; hwndSource : HWND -> "intptr" ; phThumbnailId : INT_PTR* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dwmapi = windows.NewLazySystemDLL("dwmapi.dll")
procDwmRegisterThumbnail = dwmapi.NewProc("DwmRegisterThumbnail")
)
// hwndDestination (HWND), hwndSource (HWND), phThumbnailId (INT_PTR* out)
r1, _, err := procDwmRegisterThumbnail.Call(
uintptr(hwndDestination),
uintptr(hwndSource),
uintptr(phThumbnailId),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DwmRegisterThumbnail(
hwndDestination: THandle; // HWND
hwndSource: THandle; // HWND
phThumbnailId: Pointer // INT_PTR* out
): Integer; stdcall;
external 'dwmapi.dll' name 'DwmRegisterThumbnail';result := DllCall("dwmapi\DwmRegisterThumbnail"
, "Ptr", hwndDestination ; HWND
, "Ptr", hwndSource ; HWND
, "Ptr", phThumbnailId ; INT_PTR* out
, "Int") ; return: HRESULT●DwmRegisterThumbnail(hwndDestination, hwndSource, phThumbnailId) = DLL("dwmapi.dll", "int DwmRegisterThumbnail(void*, void*, void*)")
# 呼び出し: DwmRegisterThumbnail(hwndDestination, hwndSource, phThumbnailId)
# hwndDestination : HWND -> "void*"
# hwndSource : HWND -> "void*"
# phThumbnailId : INT_PTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。