Win32 API 日本語リファレンス
ホームDevices.HumanInterfaceDevice › DIDEVICEIMAGEINFOW

DIDEVICEIMAGEINFOW

構造体
サイズx64: 612 バイト / x86: 612 バイト

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

フィールド

フィールドサイズx64x86説明
tszImagePathWCHAR520+0+0デバイス画像ファイルのパスを示すワイド文字列。
dwFlagsDWORD4+520+520画像情報の属性を示すフラグ群。
dwViewIDDWORD4+524+524デバイスの表示ビューを識別するID。
rcOverlayRECT16+528+528オーバーレイ画像を描画する矩形領域。
dwObjIDDWORD4+544+544画像が対応するデバイスオブジェクトID。
dwcValidPtsDWORD4+548+548rgptCalloutLine内の有効な点の数。
rgptCalloutLinePOINT40+552+552コールアウト線を構成する座標点の配列。
rcCalloutRectRECT16+592+592コールアウトテキストを表示する矩形領域。
dwTextAlignDWORD4+608+608コールアウトテキストの配置を示す値。

各言語での定義

#include <windows.h>

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

// POINT  (x64 8 / x86 8 バイト)
typedef struct POINT {
    INT x;
    INT y;
} POINT;

// DIDEVICEIMAGEINFOW  (x64 612 / x86 612 バイト)
typedef struct DIDEVICEIMAGEINFOW {
    WCHAR tszImagePath[260];
    DWORD dwFlags;
    DWORD dwViewID;
    RECT rcOverlay;
    DWORD dwObjID;
    DWORD dwcValidPts;
    POINT rgptCalloutLine[5];
    RECT rcCalloutRect;
    DWORD dwTextAlign;
} DIDEVICEIMAGEINFOW;
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, CharSet = CharSet.Unicode)]
public struct POINT
{
    public int x;
    public int y;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DIDEVICEIMAGEINFOW
{
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string tszImagePath;
    public uint dwFlags;
    public uint dwViewID;
    public RECT rcOverlay;
    public uint dwObjID;
    public uint dwcValidPts;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public POINT[] rgptCalloutLine;
    public RECT rcCalloutRect;
    public uint dwTextAlign;
}
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, CharSet:=CharSet.Unicode)>
Public Structure POINT
    Public x As Integer
    Public y As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DIDEVICEIMAGEINFOW
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public tszImagePath As String
    Public dwFlags As UInteger
    Public dwViewID As UInteger
    Public rcOverlay As RECT
    Public dwObjID As UInteger
    Public dwcValidPts As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=5)> Public rgptCalloutLine() As POINT
    Public rcCalloutRect As RECT
    Public dwTextAlign As UInteger
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 POINT(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_int),
        ("y", ctypes.c_int),
    ]

class DIDEVICEIMAGEINFOW(ctypes.Structure):
    _fields_ = [
        ("tszImagePath", ctypes.c_wchar * 260),
        ("dwFlags", wintypes.DWORD),
        ("dwViewID", wintypes.DWORD),
        ("rcOverlay", RECT),
        ("dwObjID", wintypes.DWORD),
        ("dwcValidPts", wintypes.DWORD),
        ("rgptCalloutLine", POINT * 5),
        ("rcCalloutRect", RECT),
        ("dwTextAlign", wintypes.DWORD),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct POINT {
    pub x: i32,
    pub y: i32,
}

#[repr(C)]
pub struct DIDEVICEIMAGEINFOW {
    pub tszImagePath: [u16; 260],
    pub dwFlags: u32,
    pub dwViewID: u32,
    pub rcOverlay: RECT,
    pub dwObjID: u32,
    pub dwcValidPts: u32,
    pub rgptCalloutLine: [POINT; 5],
    pub rcCalloutRect: RECT,
    pub dwTextAlign: u32,
}
import "golang.org/x/sys/windows"

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

type POINT struct {
	x int32
	y int32
}

type DIDEVICEIMAGEINFOW struct {
	tszImagePath [260]uint16
	dwFlags uint32
	dwViewID uint32
	rcOverlay RECT
	dwObjID uint32
	dwcValidPts uint32
	rgptCalloutLine [5]POINT
	rcCalloutRect RECT
	dwTextAlign uint32
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  POINT = record
    x: Integer;
    y: Integer;
  end;

  DIDEVICEIMAGEINFOW = record
    tszImagePath: array[0..259] of WideChar;
    dwFlags: DWORD;
    dwViewID: DWORD;
    rcOverlay: RECT;
    dwObjID: DWORD;
    dwcValidPts: DWORD;
    rgptCalloutLine: array[0..4] of POINT;
    rcCalloutRect: RECT;
    dwTextAlign: DWORD;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const POINT = extern struct {
    x: i32,
    y: i32,
};

const DIDEVICEIMAGEINFOW = extern struct {
    tszImagePath: [260]u16,
    dwFlags: u32,
    dwViewID: u32,
    rcOverlay: RECT,
    dwObjID: u32,
    dwcValidPts: u32,
    rgptCalloutLine: [5]POINT,
    rcCalloutRect: RECT,
    dwTextAlign: u32,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  POINT {.bycopy.} = object
    x: int32
    y: int32

  DIDEVICEIMAGEINFOW {.bycopy.} = object
    tszImagePath: array[260, uint16]
    dwFlags: uint32
    dwViewID: uint32
    rcOverlay: RECT
    dwObjID: uint32
    dwcValidPts: uint32
    rgptCalloutLine: array[5, POINT]
    rcCalloutRect: RECT
    dwTextAlign: uint32
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct POINT
{
    int x;
    int y;
}

struct DIDEVICEIMAGEINFOW
{
    wchar[260] tszImagePath;
    uint dwFlags;
    uint dwViewID;
    RECT rcOverlay;
    uint dwObjID;
    uint dwcValidPts;
    POINT[5] rgptCalloutLine;
    RECT rcCalloutRect;
    uint dwTextAlign;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DIDEVICEIMAGEINFOW サイズ: 612 バイト(x64)
dim st, 153    ; 4byte整数×153(構造体サイズ 612 / 4 切り上げ)
; tszImagePath : WCHAR (+0, 520byte)  varptr(st)+0 を基点に操作(520byte:入れ子/配列)
; dwFlags : DWORD (+520, 4byte)  st.130 = 値  /  値 = st.130   (lpoke/lpeek も可)
; dwViewID : DWORD (+524, 4byte)  st.131 = 値  /  値 = st.131   (lpoke/lpeek も可)
; rcOverlay : RECT (+528, 16byte)  varptr(st)+528 を基点に操作(16byte:入れ子/配列)
; dwObjID : DWORD (+544, 4byte)  st.136 = 値  /  値 = st.136   (lpoke/lpeek も可)
; dwcValidPts : DWORD (+548, 4byte)  st.137 = 値  /  値 = st.137   (lpoke/lpeek も可)
; rgptCalloutLine : POINT (+552, 40byte)  varptr(st)+552 を基点に操作(40byte:入れ子/配列)
; rcCalloutRect : RECT (+592, 16byte)  varptr(st)+592 を基点に操作(16byte:入れ子/配列)
; dwTextAlign : DWORD (+608, 4byte)  st.152 = 値  /  値 = st.152   (lpoke/lpeek も可)
; ※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 POINT
    #field int x
    #field int y
#endstruct

#defstruct global DIDEVICEIMAGEINFOW
    #field wchar tszImagePath 260
    #field int dwFlags
    #field int dwViewID
    #field RECT rcOverlay
    #field int dwObjID
    #field int dwcValidPts
    #field POINT rgptCalloutLine 5
    #field RECT rcCalloutRect
    #field int dwTextAlign
#endstruct

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