ホーム › System.Ole › PAGESET
PAGESET
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbStruct | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で表す。 |
| fOddPages | BOOL | 4 | +4 | +4 | 奇数ページを印刷するかを示すBOOLである。 |
| fEvenPages | BOOL | 4 | +8 | +8 | 偶数ページを印刷するかを示すBOOLである。 |
| cPageRange | DWORD | 4 | +12 | +12 | rgPagesに含まれるページ範囲の個数を表す。 |
| rgPages | PAGERANGE | 8 | +16 | +16 | 印刷対象のページ範囲を保持するPAGERANGE配列の先頭である。 |
各言語での定義
#include <windows.h>
// PAGERANGE (x64 8 / x86 8 バイト)
typedef struct PAGERANGE {
INT nFromPage;
INT nToPage;
} PAGERANGE;
// PAGESET (x64 24 / x86 24 バイト)
typedef struct PAGESET {
DWORD cbStruct;
BOOL fOddPages;
BOOL fEvenPages;
DWORD cPageRange;
PAGERANGE rgPages[1];
} PAGESET;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PAGERANGE
{
public int nFromPage;
public int nToPage;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PAGESET
{
public uint cbStruct;
[MarshalAs(UnmanagedType.Bool)] public bool fOddPages;
[MarshalAs(UnmanagedType.Bool)] public bool fEvenPages;
public uint cPageRange;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public PAGERANGE[] rgPages;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PAGERANGE
Public nFromPage As Integer
Public nToPage As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PAGESET
Public cbStruct As UInteger
<MarshalAs(UnmanagedType.Bool)> Public fOddPages As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fEvenPages As Boolean
Public cPageRange As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public rgPages() As PAGERANGE
End Structureimport ctypes
from ctypes import wintypes
class PAGERANGE(ctypes.Structure):
_fields_ = [
("nFromPage", ctypes.c_int),
("nToPage", ctypes.c_int),
]
class PAGESET(ctypes.Structure):
_fields_ = [
("cbStruct", wintypes.DWORD),
("fOddPages", wintypes.BOOL),
("fEvenPages", wintypes.BOOL),
("cPageRange", wintypes.DWORD),
("rgPages", PAGERANGE * 1),
]#[repr(C)]
pub struct PAGERANGE {
pub nFromPage: i32,
pub nToPage: i32,
}
#[repr(C)]
pub struct PAGESET {
pub cbStruct: u32,
pub fOddPages: i32,
pub fEvenPages: i32,
pub cPageRange: u32,
pub rgPages: [PAGERANGE; 1],
}import "golang.org/x/sys/windows"
type PAGERANGE struct {
nFromPage int32
nToPage int32
}
type PAGESET struct {
cbStruct uint32
fOddPages int32
fEvenPages int32
cPageRange uint32
rgPages [1]PAGERANGE
}type
PAGERANGE = record
nFromPage: Integer;
nToPage: Integer;
end;
PAGESET = record
cbStruct: DWORD;
fOddPages: BOOL;
fEvenPages: BOOL;
cPageRange: DWORD;
rgPages: array[0..0] of PAGERANGE;
end;const PAGERANGE = extern struct {
nFromPage: i32,
nToPage: i32,
};
const PAGESET = extern struct {
cbStruct: u32,
fOddPages: i32,
fEvenPages: i32,
cPageRange: u32,
rgPages: [1]PAGERANGE,
};type
PAGERANGE {.bycopy.} = object
nFromPage: int32
nToPage: int32
PAGESET {.bycopy.} = object
cbStruct: uint32
fOddPages: int32
fEvenPages: int32
cPageRange: uint32
rgPages: array[1, PAGERANGE]struct PAGERANGE
{
int nFromPage;
int nToPage;
}
struct PAGESET
{
uint cbStruct;
int fOddPages;
int fEvenPages;
uint cPageRange;
PAGERANGE[1] rgPages;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PAGESET サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fOddPages : BOOL (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; fEvenPages : BOOL (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cPageRange : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; rgPages : PAGERANGE (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PAGERANGE
#field int nFromPage
#field int nToPage
#endstruct
#defstruct global PAGESET
#field int cbStruct
#field bool fOddPages
#field bool fEvenPages
#field int cPageRange
#field PAGERANGE rgPages 1
#endstruct
stdim st, PAGESET ; NSTRUCT 変数を確保
st->cbStruct = 100
mes "cbStruct=" + st->cbStruct