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

DEVICEDIALOGDATA

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のサイズをバイト単位で指定する。
hwndParentHWND8/4+8+4ダイアログの親ウィンドウのハンドル。NULL可。
pIWiaItemRootIWiaItem*8/4+16+8WIAデバイスのルート項目を表すIWiaItemへのポインタ。
dwFlagsDWORD4+24+12デバイス画像ダイアログの動作を制御するフラグ。
lIntentINT4+28+16取得意図(カラー/グレースケール等)を示す値を指定する。
lItemCountINT4+32+20ppWiaItemsに返された項目の個数を表す。出力。
ppWiaItemsIWiaItem**8/4+40+24取得された各IWiaItem項目の配列へのポインタ。出力。

各言語での定義

#include <windows.h>

// DEVICEDIALOGDATA  (x64 48 / x86 28 バイト)
typedef struct DEVICEDIALOGDATA {
    DWORD cbSize;
    HWND hwndParent;
    IWiaItem* pIWiaItemRoot;
    DWORD dwFlags;
    INT lIntent;
    INT lItemCount;
    IWiaItem** ppWiaItems;
} DEVICEDIALOGDATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVICEDIALOGDATA
{
    public uint cbSize;
    public IntPtr hwndParent;
    public IntPtr pIWiaItemRoot;
    public uint dwFlags;
    public int lIntent;
    public int lItemCount;
    public IntPtr ppWiaItems;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVICEDIALOGDATA
    Public cbSize As UInteger
    Public hwndParent As IntPtr
    Public pIWiaItemRoot As IntPtr
    Public dwFlags As UInteger
    Public lIntent As Integer
    Public lItemCount As Integer
    Public ppWiaItems As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DEVICEDIALOGDATA(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("hwndParent", ctypes.c_void_p),
        ("pIWiaItemRoot", ctypes.c_void_p),
        ("dwFlags", wintypes.DWORD),
        ("lIntent", ctypes.c_int),
        ("lItemCount", ctypes.c_int),
        ("ppWiaItems", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DEVICEDIALOGDATA {
    pub cbSize: u32,
    pub hwndParent: *mut core::ffi::c_void,
    pub pIWiaItemRoot: *mut core::ffi::c_void,
    pub dwFlags: u32,
    pub lIntent: i32,
    pub lItemCount: i32,
    pub ppWiaItems: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DEVICEDIALOGDATA struct {
	cbSize uint32
	hwndParent uintptr
	pIWiaItemRoot uintptr
	dwFlags uint32
	lIntent int32
	lItemCount int32
	ppWiaItems uintptr
}
type
  DEVICEDIALOGDATA = record
    cbSize: DWORD;
    hwndParent: Pointer;
    pIWiaItemRoot: Pointer;
    dwFlags: DWORD;
    lIntent: Integer;
    lItemCount: Integer;
    ppWiaItems: Pointer;
  end;
const DEVICEDIALOGDATA = extern struct {
    cbSize: u32,
    hwndParent: ?*anyopaque,
    pIWiaItemRoot: ?*anyopaque,
    dwFlags: u32,
    lIntent: i32,
    lItemCount: i32,
    ppWiaItems: ?*anyopaque,
};
type
  DEVICEDIALOGDATA {.bycopy.} = object
    cbSize: uint32
    hwndParent: pointer
    pIWiaItemRoot: pointer
    dwFlags: uint32
    lIntent: int32
    lItemCount: int32
    ppWiaItems: pointer
struct DEVICEDIALOGDATA
{
    uint cbSize;
    void* hwndParent;
    void* pIWiaItemRoot;
    uint dwFlags;
    int lIntent;
    int lItemCount;
    void* ppWiaItems;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DEVICEDIALOGDATA サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hwndParent : HWND (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; pIWiaItemRoot : IWiaItem* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwFlags : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lIntent : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lItemCount : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ppWiaItems : IWiaItem** (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEVICEDIALOGDATA サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hwndParent : HWND (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pIWiaItemRoot : IWiaItem* (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwFlags : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; lIntent : INT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; lItemCount : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ppWiaItems : IWiaItem** (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEVICEDIALOGDATA
    #field int cbSize
    #field intptr hwndParent
    #field intptr pIWiaItemRoot
    #field int dwFlags
    #field int lIntent
    #field int lItemCount
    #field intptr ppWiaItems
#endstruct

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