ホーム › UI.WindowsAndMessaging › DLGTEMPLATE
DLGTEMPLATE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| style | DWORD | 4 | +0 | +0 | ダイアログボックスのスタイルである。 |
| dwExtendedStyle | DWORD | 4 | +4 | +4 | ダイアログボックスの拡張スタイルである。 |
| cdit | WORD | 2 | +8 | +8 | ダイアログ内のコントロール(ダイアログアイテム)の数である。 |
| x | SHORT | 2 | +10 | +10 | ダイアログボックスの左端の x 座標(ダイアログ単位)である。 |
| y | SHORT | 2 | +12 | +12 | ダイアログボックスの上端の y 座標(ダイアログ単位)である。 |
| cx | SHORT | 2 | +14 | +14 | ダイアログボックスの幅(ダイアログ単位)である。 |
| cy | SHORT | 2 | +16 | +16 | ダイアログボックスの高さ(ダイアログ単位)である。 |
各言語での定義
#include <windows.h>
// DLGTEMPLATE (x64 18 / x86 18 バイト)
#pragma pack(push, 2)
typedef struct DLGTEMPLATE {
DWORD style;
DWORD dwExtendedStyle;
WORD cdit;
SHORT x;
SHORT y;
SHORT cx;
SHORT cy;
} DLGTEMPLATE;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 2, CharSet = CharSet.Unicode)]
public struct DLGTEMPLATE
{
public uint style;
public uint dwExtendedStyle;
public ushort cdit;
public short x;
public short y;
public short cx;
public short cy;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=2, CharSet:=CharSet.Unicode)>
Public Structure DLGTEMPLATE
Public style As UInteger
Public dwExtendedStyle As UInteger
Public cdit As UShort
Public x As Short
Public y As Short
Public cx As Short
Public cy As Short
End Structureimport ctypes
from ctypes import wintypes
class DLGTEMPLATE(ctypes.Structure):
_pack_ = 2
_fields_ = [
("style", wintypes.DWORD),
("dwExtendedStyle", wintypes.DWORD),
("cdit", ctypes.c_ushort),
("x", ctypes.c_short),
("y", ctypes.c_short),
("cx", ctypes.c_short),
("cy", ctypes.c_short),
]#[repr(C, packed(2))]
pub struct DLGTEMPLATE {
pub style: u32,
pub dwExtendedStyle: u32,
pub cdit: u16,
pub x: i16,
pub y: i16,
pub cx: i16,
pub cy: i16,
}import "golang.org/x/sys/windows"
type DLGTEMPLATE struct {
style uint32
dwExtendedStyle uint32
cdit uint16
x int16
y int16
cx int16
cy int16
}type
DLGTEMPLATE = packed record
style: DWORD;
dwExtendedStyle: DWORD;
cdit: Word;
x: Smallint;
y: Smallint;
cx: Smallint;
cy: Smallint;
end;const DLGTEMPLATE = extern struct {
style: u32,
dwExtendedStyle: u32,
cdit: u16,
x: i16,
y: i16,
cx: i16,
cy: i16,
};type
DLGTEMPLATE {.packed.} = object
style: uint32
dwExtendedStyle: uint32
cdit: uint16
x: int16
y: int16
cx: int16
cy: int16align(2)
struct DLGTEMPLATE
{
uint style;
uint dwExtendedStyle;
ushort cdit;
short x;
short y;
short cx;
short cy;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DLGTEMPLATE サイズ: 18 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 18 / 4 切り上げ)
; style : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwExtendedStyle : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cdit : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; x : SHORT (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; y : SHORT (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; cx : SHORT (+14, 2byte) wpoke st,14,値 / 値 = wpeek(st,14)
; cy : SHORT (+16, 2byte) wpoke st,16,値 / 値 = wpeek(st,16)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DLGTEMPLATE, pack=2
#field int style
#field int dwExtendedStyle
#field short cdit
#field short x
#field short y
#field short cx
#field short cy
#endstruct
stdim st, DLGTEMPLATE ; NSTRUCT 変数を確保
st->style = 100
mes "style=" + st->style