ホーム › UI.Controls.Dialogs › PRINTDLGW
PRINTDLGW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| lStructSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で指定する。PrintDlgW呼び出し前に設定する。 |
| hwndOwner | HWND | 8/4 | +4 | +4 | 印刷ダイアログを所有する親ウィンドウのハンドル。NULL可。 |
| hDevMode | HGLOBAL | 8/4 | +12 | +8 | DEVMODE構造体を含むグローバルメモリのハンドル。入出力に使われる。 |
| hDevNames | HGLOBAL | 8/4 | +20 | +12 | DEVNAMES構造体を含むグローバルメモリのハンドル。プリンタ名等を保持する。 |
| hDC | HDC | 8/4 | +28 | +16 | 選択プリンタのデバイスコンテキストまたは情報コンテキストのハンドルを受け取る。 |
| Flags | PRINTDLGEX_FLAGS | 4 | +36 | +20 | ダイアログの初期化や動作を制御するPD_系フラグの組み合わせ。 |
| nFromPage | WORD | 2 | +40 | +24 | 印刷範囲の開始ページ番号。PD_PAGENUMS指定時に有効。 |
| nToPage | WORD | 2 | +42 | +26 | 印刷範囲の終了ページ番号。PD_PAGENUMS指定時に有効。 |
| nMinPage | WORD | 2 | +44 | +28 | 指定可能な最小ページ番号。 |
| nMaxPage | WORD | 2 | +46 | +30 | 指定可能な最大ページ番号。 |
| nCopies | WORD | 2 | +48 | +32 | 印刷部数。hDevMode未指定時に使われる。 |
| hInstance | HINSTANCE | 8/4 | +50 | +34 | テンプレートを含むモジュールのインスタンスハンドル。 |
| lCustData | LPARAM | 8/4 | +58 | +38 | フックプロシージャに渡されるアプリケーション定義データ。 |
| lpfnPrintHook | LPPRINTHOOKPROC | 8/4 | +66 | +42 | 印刷ダイアログ用フックプロシージャへのポインタ。PD_ENABLEPRINTHOOK時に有効。 |
| lpfnSetupHook | LPSETUPHOOKPROC | 8/4 | +74 | +46 | プリンタ設定ダイアログ用フックプロシージャへのポインタ。PD_ENABLESETUPHOOK時に有効。 |
| lpPrintTemplateName | LPWSTR | 8/4 | +82 | +50 | 印刷ダイアログのカスタムテンプレートのリソース名。 |
| lpSetupTemplateName | LPWSTR | 8/4 | +90 | +54 | 設定ダイアログのカスタムテンプレートのリソース名。 |
| hPrintTemplate | HGLOBAL | 8/4 | +98 | +58 | 印刷ダイアログテンプレートを含むメモリブロックのハンドル。 |
| hSetupTemplate | HGLOBAL | 8/4 | +106 | +62 | 設定ダイアログテンプレートを含むメモリブロックのハンドル。 |
各言語での定義
#include <windows.h>
// PRINTDLGW (x64 114 / x86 66 バイト)
#pragma pack(push, 1)
typedef struct PRINTDLGW {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
HDC hDC;
PRINTDLGEX_FLAGS Flags;
WORD nFromPage;
WORD nToPage;
WORD nMinPage;
WORD nMaxPage;
WORD nCopies;
HINSTANCE hInstance;
LPARAM lCustData;
LPPRINTHOOKPROC lpfnPrintHook;
LPSETUPHOOKPROC lpfnSetupHook;
LPWSTR lpPrintTemplateName;
LPWSTR lpSetupTemplateName;
HGLOBAL hPrintTemplate;
HGLOBAL hSetupTemplate;
} PRINTDLGW;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct PRINTDLGW
{
public uint lStructSize;
public IntPtr hwndOwner;
public IntPtr hDevMode;
public IntPtr hDevNames;
public IntPtr hDC;
public uint Flags;
public ushort nFromPage;
public ushort nToPage;
public ushort nMinPage;
public ushort nMaxPage;
public ushort nCopies;
public IntPtr hInstance;
public IntPtr lCustData;
public IntPtr lpfnPrintHook;
public IntPtr lpfnSetupHook;
public IntPtr lpPrintTemplateName;
public IntPtr lpSetupTemplateName;
public IntPtr hPrintTemplate;
public IntPtr hSetupTemplate;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure PRINTDLGW
Public lStructSize As UInteger
Public hwndOwner As IntPtr
Public hDevMode As IntPtr
Public hDevNames As IntPtr
Public hDC As IntPtr
Public Flags As UInteger
Public nFromPage As UShort
Public nToPage As UShort
Public nMinPage As UShort
Public nMaxPage As UShort
Public nCopies As UShort
Public hInstance As IntPtr
Public lCustData As IntPtr
Public lpfnPrintHook As IntPtr
Public lpfnSetupHook As IntPtr
Public lpPrintTemplateName As IntPtr
Public lpSetupTemplateName As IntPtr
Public hPrintTemplate As IntPtr
Public hSetupTemplate As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class PRINTDLGW(ctypes.Structure):
_pack_ = 1
_fields_ = [
("lStructSize", wintypes.DWORD),
("hwndOwner", ctypes.c_void_p),
("hDevMode", ctypes.c_void_p),
("hDevNames", ctypes.c_void_p),
("hDC", ctypes.c_void_p),
("Flags", wintypes.DWORD),
("nFromPage", ctypes.c_ushort),
("nToPage", ctypes.c_ushort),
("nMinPage", ctypes.c_ushort),
("nMaxPage", ctypes.c_ushort),
("nCopies", ctypes.c_ushort),
("hInstance", ctypes.c_void_p),
("lCustData", ctypes.c_ssize_t),
("lpfnPrintHook", ctypes.c_void_p),
("lpfnSetupHook", ctypes.c_void_p),
("lpPrintTemplateName", ctypes.c_void_p),
("lpSetupTemplateName", ctypes.c_void_p),
("hPrintTemplate", ctypes.c_void_p),
("hSetupTemplate", ctypes.c_void_p),
]#[repr(C, packed(1))]
pub struct PRINTDLGW {
pub lStructSize: u32,
pub hwndOwner: *mut core::ffi::c_void,
pub hDevMode: *mut core::ffi::c_void,
pub hDevNames: *mut core::ffi::c_void,
pub hDC: *mut core::ffi::c_void,
pub Flags: u32,
pub nFromPage: u16,
pub nToPage: u16,
pub nMinPage: u16,
pub nMaxPage: u16,
pub nCopies: u16,
pub hInstance: *mut core::ffi::c_void,
pub lCustData: isize,
pub lpfnPrintHook: *mut core::ffi::c_void,
pub lpfnSetupHook: *mut core::ffi::c_void,
pub lpPrintTemplateName: *mut core::ffi::c_void,
pub lpSetupTemplateName: *mut core::ffi::c_void,
pub hPrintTemplate: *mut core::ffi::c_void,
pub hSetupTemplate: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type PRINTDLGW struct {
lStructSize uint32
hwndOwner uintptr
hDevMode uintptr
hDevNames uintptr
hDC uintptr
Flags uint32
nFromPage uint16
nToPage uint16
nMinPage uint16
nMaxPage uint16
nCopies uint16
hInstance uintptr
lCustData uintptr
lpfnPrintHook uintptr
lpfnSetupHook uintptr
lpPrintTemplateName uintptr
lpSetupTemplateName uintptr
hPrintTemplate uintptr
hSetupTemplate uintptr
}type
PRINTDLGW = packed record
lStructSize: DWORD;
hwndOwner: Pointer;
hDevMode: Pointer;
hDevNames: Pointer;
hDC: Pointer;
Flags: DWORD;
nFromPage: Word;
nToPage: Word;
nMinPage: Word;
nMaxPage: Word;
nCopies: Word;
hInstance: Pointer;
lCustData: NativeInt;
lpfnPrintHook: Pointer;
lpfnSetupHook: Pointer;
lpPrintTemplateName: Pointer;
lpSetupTemplateName: Pointer;
hPrintTemplate: Pointer;
hSetupTemplate: Pointer;
end;const PRINTDLGW = extern struct {
lStructSize: u32,
hwndOwner: ?*anyopaque,
hDevMode: ?*anyopaque,
hDevNames: ?*anyopaque,
hDC: ?*anyopaque,
Flags: u32,
nFromPage: u16,
nToPage: u16,
nMinPage: u16,
nMaxPage: u16,
nCopies: u16,
hInstance: ?*anyopaque,
lCustData: isize,
lpfnPrintHook: ?*anyopaque,
lpfnSetupHook: ?*anyopaque,
lpPrintTemplateName: ?*anyopaque,
lpSetupTemplateName: ?*anyopaque,
hPrintTemplate: ?*anyopaque,
hSetupTemplate: ?*anyopaque,
};type
PRINTDLGW {.packed.} = object
lStructSize: uint32
hwndOwner: pointer
hDevMode: pointer
hDevNames: pointer
hDC: pointer
Flags: uint32
nFromPage: uint16
nToPage: uint16
nMinPage: uint16
nMaxPage: uint16
nCopies: uint16
hInstance: pointer
lCustData: int
lpfnPrintHook: pointer
lpfnSetupHook: pointer
lpPrintTemplateName: pointer
lpSetupTemplateName: pointer
hPrintTemplate: pointer
hSetupTemplate: pointeralign(1)
struct PRINTDLGW
{
uint lStructSize;
void* hwndOwner;
void* hDevMode;
void* hDevNames;
void* hDC;
uint Flags;
ushort nFromPage;
ushort nToPage;
ushort nMinPage;
ushort nMaxPage;
ushort nCopies;
void* hInstance;
ptrdiff_t lCustData;
void* lpfnPrintHook;
void* lpfnSetupHook;
void* lpPrintTemplateName;
void* lpSetupTemplateName;
void* hPrintTemplate;
void* hSetupTemplate;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PRINTDLGW サイズ: 66 バイト(x86)
dim st, 17 ; 4byte整数×17(構造体サイズ 66 / 4 切り上げ)
; lStructSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hwndOwner : HWND (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hDevMode : HGLOBAL (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; hDevNames : HGLOBAL (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; hDC : HDC (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Flags : PRINTDLGEX_FLAGS (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; nFromPage : WORD (+24, 2byte) wpoke st,24,値 / 値 = wpeek(st,24)
; nToPage : WORD (+26, 2byte) wpoke st,26,値 / 値 = wpeek(st,26)
; nMinPage : WORD (+28, 2byte) wpoke st,28,値 / 値 = wpeek(st,28)
; nMaxPage : WORD (+30, 2byte) wpoke st,30,値 / 値 = wpeek(st,30)
; nCopies : WORD (+32, 2byte) wpoke st,32,値 / 値 = wpeek(st,32)
; hInstance : HINSTANCE (+34, 4byte) lpoke st,34,値 / 値 = lpeek(st,34)
; lCustData : LPARAM (+38, 4byte) lpoke st,38,値 / 値 = lpeek(st,38)
; lpfnPrintHook : LPPRINTHOOKPROC (+42, 4byte) lpoke st,42,値 / 値 = lpeek(st,42)
; lpfnSetupHook : LPSETUPHOOKPROC (+46, 4byte) lpoke st,46,値 / 値 = lpeek(st,46)
; lpPrintTemplateName : LPWSTR (+50, 4byte) lpoke st,50,値 / 値 = lpeek(st,50)
; lpSetupTemplateName : LPWSTR (+54, 4byte) lpoke st,54,値 / 値 = lpeek(st,54)
; hPrintTemplate : HGLOBAL (+58, 4byte) lpoke st,58,値 / 値 = lpeek(st,58)
; hSetupTemplate : HGLOBAL (+62, 4byte) lpoke st,62,値 / 値 = lpeek(st,62)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PRINTDLGW サイズ: 114 バイト(x64)
dim st, 29 ; 4byte整数×29(構造体サイズ 114 / 4 切り上げ)
; lStructSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hwndOwner : HWND (+4, 8byte) qpoke st,4,値 / qpeek(st,4) ※IronHSPのみ。3.7/3.8は lpoke st,4,下位 : lpoke st,8,上位
; hDevMode : HGLOBAL (+12, 8byte) qpoke st,12,値 / qpeek(st,12) ※IronHSPのみ。3.7/3.8は lpoke st,12,下位 : lpoke st,16,上位
; hDevNames : HGLOBAL (+20, 8byte) qpoke st,20,値 / qpeek(st,20) ※IronHSPのみ。3.7/3.8は lpoke st,20,下位 : lpoke st,24,上位
; hDC : HDC (+28, 8byte) qpoke st,28,値 / qpeek(st,28) ※IronHSPのみ。3.7/3.8は lpoke st,28,下位 : lpoke st,32,上位
; Flags : PRINTDLGEX_FLAGS (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; nFromPage : WORD (+40, 2byte) wpoke st,40,値 / 値 = wpeek(st,40)
; nToPage : WORD (+42, 2byte) wpoke st,42,値 / 値 = wpeek(st,42)
; nMinPage : WORD (+44, 2byte) wpoke st,44,値 / 値 = wpeek(st,44)
; nMaxPage : WORD (+46, 2byte) wpoke st,46,値 / 値 = wpeek(st,46)
; nCopies : WORD (+48, 2byte) wpoke st,48,値 / 値 = wpeek(st,48)
; hInstance : HINSTANCE (+50, 8byte) qpoke st,50,値 / qpeek(st,50) ※IronHSPのみ。3.7/3.8は lpoke st,50,下位 : lpoke st,54,上位
; lCustData : LPARAM (+58, 8byte) qpoke st,58,値 / qpeek(st,58) ※IronHSPのみ。3.7/3.8は lpoke st,58,下位 : lpoke st,62,上位
; lpfnPrintHook : LPPRINTHOOKPROC (+66, 8byte) qpoke st,66,値 / qpeek(st,66) ※IronHSPのみ。3.7/3.8は lpoke st,66,下位 : lpoke st,70,上位
; lpfnSetupHook : LPSETUPHOOKPROC (+74, 8byte) qpoke st,74,値 / qpeek(st,74) ※IronHSPのみ。3.7/3.8は lpoke st,74,下位 : lpoke st,78,上位
; lpPrintTemplateName : LPWSTR (+82, 8byte) qpoke st,82,値 / qpeek(st,82) ※IronHSPのみ。3.7/3.8は lpoke st,82,下位 : lpoke st,86,上位
; lpSetupTemplateName : LPWSTR (+90, 8byte) qpoke st,90,値 / qpeek(st,90) ※IronHSPのみ。3.7/3.8は lpoke st,90,下位 : lpoke st,94,上位
; hPrintTemplate : HGLOBAL (+98, 8byte) qpoke st,98,値 / qpeek(st,98) ※IronHSPのみ。3.7/3.8は lpoke st,98,下位 : lpoke st,102,上位
; hSetupTemplate : HGLOBAL (+106, 8byte) qpoke st,106,値 / qpeek(st,106) ※IronHSPのみ。3.7/3.8は lpoke st,106,下位 : lpoke st,110,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PRINTDLGW, pack=1
#field int lStructSize
#field intptr hwndOwner
#field intptr hDevMode
#field intptr hDevNames
#field intptr hDC
#field int Flags
#field short nFromPage
#field short nToPage
#field short nMinPage
#field short nMaxPage
#field short nCopies
#field intptr hInstance
#field intptr lCustData
#field intptr lpfnPrintHook
#field intptr lpfnSetupHook
#field intptr lpPrintTemplateName
#field intptr lpSetupTemplateName
#field intptr hPrintTemplate
#field intptr hSetupTemplate
#endstruct
stdim st, PRINTDLGW ; NSTRUCT 変数を確保
st->lStructSize = 100
mes "lStructSize=" + st->lStructSize