Win32 API 日本語リファレンス
ホームGraphics.Dwm › DWM_THUMBNAIL_PROPERTIES

DWM_THUMBNAIL_PROPERTIES

構造体
サイズx64: 45 バイト / x86: 45 バイトパッキング1

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwFlagsDWORD4+0+0有効なメンバを示すDWM_TNP_*ビットフラグの組み合わせ。
rcDestinationRECT16+4+4サムネイルを描画する転送先矩形。
rcSourceRECT16+20+20ソースから切り出す転送元矩形。
opacityBYTE1+36+36サムネイルの不透明度。0で完全透明、255で不透明。
fVisibleBOOL4+37+37サムネイルを表示するかを示すブール値。
fSourceClientAreaOnlyBOOL4+41+41ソースのクライアント領域のみを描画するかを示すブール値。

各言語での定義

#include <windows.h>

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// DWM_THUMBNAIL_PROPERTIES  (x64 45 / x86 45 バイト)
#pragma pack(push, 1)
typedef struct DWM_THUMBNAIL_PROPERTIES {
    DWORD dwFlags;
    RECT rcDestination;
    RECT rcSource;
    BYTE opacity;
    BOOL fVisible;
    BOOL fSourceClientAreaOnly;
} DWM_THUMBNAIL_PROPERTIES;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DWM_THUMBNAIL_PROPERTIES
{
    public uint dwFlags;
    public RECT rcDestination;
    public RECT rcSource;
    public byte opacity;
    [MarshalAs(UnmanagedType.Bool)] public bool fVisible;
    [MarshalAs(UnmanagedType.Bool)] public bool fSourceClientAreaOnly;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DWM_THUMBNAIL_PROPERTIES
    Public dwFlags As UInteger
    Public rcDestination As RECT
    Public rcSource As RECT
    Public opacity As Byte
    <MarshalAs(UnmanagedType.Bool)> Public fVisible As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fSourceClientAreaOnly As Boolean
End Structure
import ctypes
from ctypes import wintypes

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class DWM_THUMBNAIL_PROPERTIES(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("dwFlags", wintypes.DWORD),
        ("rcDestination", RECT),
        ("rcSource", RECT),
        ("opacity", ctypes.c_ubyte),
        ("fVisible", wintypes.BOOL),
        ("fSourceClientAreaOnly", wintypes.BOOL),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C, packed(1))]
pub struct DWM_THUMBNAIL_PROPERTIES {
    pub dwFlags: u32,
    pub rcDestination: RECT,
    pub rcSource: RECT,
    pub opacity: u8,
    pub fVisible: i32,
    pub fSourceClientAreaOnly: i32,
}
import "golang.org/x/sys/windows"

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type DWM_THUMBNAIL_PROPERTIES struct {
	dwFlags uint32
	rcDestination RECT
	rcSource RECT
	opacity byte
	fVisible int32
	fSourceClientAreaOnly int32
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  DWM_THUMBNAIL_PROPERTIES = packed record
    dwFlags: DWORD;
    rcDestination: RECT;
    rcSource: RECT;
    opacity: Byte;
    fVisible: BOOL;
    fSourceClientAreaOnly: BOOL;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const DWM_THUMBNAIL_PROPERTIES = extern struct {
    dwFlags: u32,
    rcDestination: RECT,
    rcSource: RECT,
    opacity: u8,
    fVisible: i32,
    fSourceClientAreaOnly: i32,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  DWM_THUMBNAIL_PROPERTIES {.packed.} = object
    dwFlags: uint32
    rcDestination: RECT
    rcSource: RECT
    opacity: uint8
    fVisible: int32
    fSourceClientAreaOnly: int32
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

align(1)
struct DWM_THUMBNAIL_PROPERTIES
{
    uint dwFlags;
    RECT rcDestination;
    RECT rcSource;
    ubyte opacity;
    int fVisible;
    int fSourceClientAreaOnly;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DWM_THUMBNAIL_PROPERTIES サイズ: 45 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 45 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; rcDestination : RECT (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; rcSource : RECT (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; opacity : BYTE (+36, 1byte)  poke st,36,値  /  値 = peek(st,36)
; fVisible : BOOL (+37, 4byte)  lpoke st,37,値  /  値 = lpeek(st,37)
; fSourceClientAreaOnly : BOOL (+41, 4byte)  lpoke st,41,値  /  値 = lpeek(st,41)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global DWM_THUMBNAIL_PROPERTIES, pack=1
    #field int dwFlags
    #field RECT rcDestination
    #field RECT rcSource
    #field byte opacity
    #field bool fVisible
    #field bool fSourceClientAreaOnly
#endstruct

stdim st, DWM_THUMBNAIL_PROPERTIES        ; NSTRUCT 変数を確保
st->dwFlags = 100
mes "dwFlags=" + st->dwFlags