ホーム › UI.WindowsAndMessaging › CREATESTRUCTA
CREATESTRUCTA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| lpCreateParams | void* | 8/4 | +0 | +0 | ウィンドウ作成に使用する追加データへのポインタである。 |
| hInstance | HINSTANCE | 8/4 | +8 | +4 | 新しいウィンドウを所有するモジュールのインスタンスハンドルである。 |
| hMenu | HMENU | 8/4 | +16 | +8 | 新しいウィンドウが使用するメニューのハンドル、または子ウィンドウの場合は子 ID である。 |
| hwndParent | HWND | 8/4 | +24 | +12 | 親ウィンドウまたはオーナーウィンドウのハンドルである。トップレベルウィンドウでは NULL となる。 |
| cy | INT | 4 | +32 | +16 | 新しいウィンドウの高さ(ピクセル)である。 |
| cx | INT | 4 | +36 | +20 | 新しいウィンドウの幅(ピクセル)である。 |
| y | INT | 4 | +40 | +24 | 新しいウィンドウの上端の位置である。 |
| x | INT | 4 | +44 | +28 | 新しいウィンドウの左端の位置である。 |
| style | INT | 4 | +48 | +32 | 新しいウィンドウのスタイルである。 |
| lpszName | LPSTR | 8/4 | +56 | +36 | 新しいウィンドウの名前(ANSI 文字列)へのポインタである。 |
| lpszClass | LPSTR | 8/4 | +64 | +40 | 新しいウィンドウのクラス名(ANSI 文字列)へのポインタである。 |
| dwExStyle | WINDOW_EX_STYLE | 4 | +72 | +44 | 新しいウィンドウの拡張スタイルである。 |
各言語での定義
#include <windows.h>
// CREATESTRUCTA (x64 80 / x86 48 バイト)
typedef struct CREATESTRUCTA {
void* lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
INT cy;
INT cx;
INT y;
INT x;
INT style;
LPSTR lpszName;
LPSTR lpszClass;
WINDOW_EX_STYLE dwExStyle;
} CREATESTRUCTA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CREATESTRUCTA
{
public IntPtr lpCreateParams;
public IntPtr hInstance;
public IntPtr hMenu;
public IntPtr hwndParent;
public int cy;
public int cx;
public int y;
public int x;
public int style;
public IntPtr lpszName;
public IntPtr lpszClass;
public uint dwExStyle;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CREATESTRUCTA
Public lpCreateParams As IntPtr
Public hInstance As IntPtr
Public hMenu As IntPtr
Public hwndParent As IntPtr
Public cy As Integer
Public cx As Integer
Public y As Integer
Public x As Integer
Public style As Integer
Public lpszName As IntPtr
Public lpszClass As IntPtr
Public dwExStyle As UInteger
End Structureimport ctypes
from ctypes import wintypes
class CREATESTRUCTA(ctypes.Structure):
_fields_ = [
("lpCreateParams", ctypes.c_void_p),
("hInstance", ctypes.c_void_p),
("hMenu", ctypes.c_void_p),
("hwndParent", ctypes.c_void_p),
("cy", ctypes.c_int),
("cx", ctypes.c_int),
("y", ctypes.c_int),
("x", ctypes.c_int),
("style", ctypes.c_int),
("lpszName", ctypes.c_void_p),
("lpszClass", ctypes.c_void_p),
("dwExStyle", wintypes.DWORD),
]#[repr(C)]
pub struct CREATESTRUCTA {
pub lpCreateParams: *mut core::ffi::c_void,
pub hInstance: *mut core::ffi::c_void,
pub hMenu: *mut core::ffi::c_void,
pub hwndParent: *mut core::ffi::c_void,
pub cy: i32,
pub cx: i32,
pub y: i32,
pub x: i32,
pub style: i32,
pub lpszName: *mut core::ffi::c_void,
pub lpszClass: *mut core::ffi::c_void,
pub dwExStyle: u32,
}import "golang.org/x/sys/windows"
type CREATESTRUCTA struct {
lpCreateParams uintptr
hInstance uintptr
hMenu uintptr
hwndParent uintptr
cy int32
cx int32
y int32
x int32
style int32
lpszName uintptr
lpszClass uintptr
dwExStyle uint32
}type
CREATESTRUCTA = record
lpCreateParams: Pointer;
hInstance: Pointer;
hMenu: Pointer;
hwndParent: Pointer;
cy: Integer;
cx: Integer;
y: Integer;
x: Integer;
style: Integer;
lpszName: Pointer;
lpszClass: Pointer;
dwExStyle: DWORD;
end;const CREATESTRUCTA = extern struct {
lpCreateParams: ?*anyopaque,
hInstance: ?*anyopaque,
hMenu: ?*anyopaque,
hwndParent: ?*anyopaque,
cy: i32,
cx: i32,
y: i32,
x: i32,
style: i32,
lpszName: ?*anyopaque,
lpszClass: ?*anyopaque,
dwExStyle: u32,
};type
CREATESTRUCTA {.bycopy.} = object
lpCreateParams: pointer
hInstance: pointer
hMenu: pointer
hwndParent: pointer
cy: int32
cx: int32
y: int32
x: int32
style: int32
lpszName: pointer
lpszClass: pointer
dwExStyle: uint32struct CREATESTRUCTA
{
void* lpCreateParams;
void* hInstance;
void* hMenu;
void* hwndParent;
int cy;
int cx;
int y;
int x;
int style;
void* lpszName;
void* lpszClass;
uint dwExStyle;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CREATESTRUCTA サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; lpCreateParams : void* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hInstance : HINSTANCE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hMenu : HMENU (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; hwndParent : HWND (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; cy : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cx : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; y : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; x : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; style : INT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lpszName : LPSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; lpszClass : LPSTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwExStyle : WINDOW_EX_STYLE (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CREATESTRUCTA サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; lpCreateParams : void* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; hInstance : HINSTANCE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; hMenu : HMENU (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hwndParent : HWND (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; cy : INT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; cx : INT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; y : INT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; x : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; style : INT (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; lpszName : LPSTR (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; lpszClass : LPSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; dwExStyle : WINDOW_EX_STYLE (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CREATESTRUCTA
#field intptr lpCreateParams
#field intptr hInstance
#field intptr hMenu
#field intptr hwndParent
#field int cy
#field int cx
#field int y
#field int x
#field int style
#field intptr lpszName
#field intptr lpszClass
#field int dwExStyle
#endstruct
stdim st, CREATESTRUCTA ; NSTRUCT 変数を確保
st->cy = 100
mes "cy=" + st->cy