ホーム › UI.WindowsAndMessaging › WNDCLASSW
WNDCLASSW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| style | WNDCLASS_STYLES | 4 | +0 | +0 | クラススタイルを指定する(CS_HREDRAW など)。 |
| lpfnWndProc | WNDPROC | 8/4 | +8 | +4 | このクラスのウィンドウプロシージャへのポインタである。 |
| cbClsExtra | INT | 4 | +16 | +8 | クラス構造体の後に確保する追加バイト数である。 |
| cbWndExtra | INT | 4 | +20 | +12 | 各ウィンドウインスタンスの後に確保する追加バイト数である。 |
| hInstance | HINSTANCE | 8/4 | +24 | +16 | このクラスのウィンドウプロシージャを含むインスタンスのハンドルである。 |
| hIcon | HICON | 8/4 | +32 | +20 | クラスのアイコンへのハンドルである。NULL の場合は既定のアイコンが使われる。 |
| hCursor | HCURSOR | 8/4 | +40 | +24 | クラスのカーソルへのハンドルである。NULL の場合はアプリケーションがカーソルを明示的に設定する必要がある。 |
| hbrBackground | HBRUSH | 8/4 | +48 | +28 | 背景ブラシのハンドル、またはシステムカラー値+1 を指定する。NULL の場合は背景を自前で描画する。 |
| lpszMenuName | LPWSTR | 8/4 | +56 | +32 | クラスの既定メニューのリソース名(Unicode 文字列)へのポインタである。NULL の場合は既定メニューを持たない。 |
| lpszClassName | LPWSTR | 8/4 | +64 | +36 | ウィンドウクラス名(Unicode 文字列)へのポインタである。 |
各言語での定義
#include <windows.h>
// WNDCLASSW (x64 72 / x86 40 バイト)
typedef struct WNDCLASSW {
WNDCLASS_STYLES style;
WNDPROC lpfnWndProc;
INT cbClsExtra;
INT cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPWSTR lpszMenuName;
LPWSTR lpszClassName;
} WNDCLASSW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WNDCLASSW
{
public uint style;
public IntPtr lpfnWndProc;
public int cbClsExtra;
public int cbWndExtra;
public IntPtr hInstance;
public IntPtr hIcon;
public IntPtr hCursor;
public IntPtr hbrBackground;
public IntPtr lpszMenuName;
public IntPtr lpszClassName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WNDCLASSW
Public style As UInteger
Public lpfnWndProc As IntPtr
Public cbClsExtra As Integer
Public cbWndExtra As Integer
Public hInstance As IntPtr
Public hIcon As IntPtr
Public hCursor As IntPtr
Public hbrBackground As IntPtr
Public lpszMenuName As IntPtr
Public lpszClassName As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class WNDCLASSW(ctypes.Structure):
_fields_ = [
("style", wintypes.DWORD),
("lpfnWndProc", ctypes.c_void_p),
("cbClsExtra", ctypes.c_int),
("cbWndExtra", ctypes.c_int),
("hInstance", ctypes.c_void_p),
("hIcon", ctypes.c_void_p),
("hCursor", ctypes.c_void_p),
("hbrBackground", ctypes.c_void_p),
("lpszMenuName", ctypes.c_void_p),
("lpszClassName", ctypes.c_void_p),
]#[repr(C)]
pub struct WNDCLASSW {
pub style: u32,
pub lpfnWndProc: *mut core::ffi::c_void,
pub cbClsExtra: i32,
pub cbWndExtra: i32,
pub hInstance: *mut core::ffi::c_void,
pub hIcon: *mut core::ffi::c_void,
pub hCursor: *mut core::ffi::c_void,
pub hbrBackground: *mut core::ffi::c_void,
pub lpszMenuName: *mut core::ffi::c_void,
pub lpszClassName: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type WNDCLASSW struct {
style uint32
lpfnWndProc uintptr
cbClsExtra int32
cbWndExtra int32
hInstance uintptr
hIcon uintptr
hCursor uintptr
hbrBackground uintptr
lpszMenuName uintptr
lpszClassName uintptr
}type
WNDCLASSW = record
style: DWORD;
lpfnWndProc: Pointer;
cbClsExtra: Integer;
cbWndExtra: Integer;
hInstance: Pointer;
hIcon: Pointer;
hCursor: Pointer;
hbrBackground: Pointer;
lpszMenuName: Pointer;
lpszClassName: Pointer;
end;const WNDCLASSW = extern struct {
style: u32,
lpfnWndProc: ?*anyopaque,
cbClsExtra: i32,
cbWndExtra: i32,
hInstance: ?*anyopaque,
hIcon: ?*anyopaque,
hCursor: ?*anyopaque,
hbrBackground: ?*anyopaque,
lpszMenuName: ?*anyopaque,
lpszClassName: ?*anyopaque,
};type
WNDCLASSW {.bycopy.} = object
style: uint32
lpfnWndProc: pointer
cbClsExtra: int32
cbWndExtra: int32
hInstance: pointer
hIcon: pointer
hCursor: pointer
hbrBackground: pointer
lpszMenuName: pointer
lpszClassName: pointerstruct WNDCLASSW
{
uint style;
void* lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
void* hInstance;
void* hIcon;
void* hCursor;
void* hbrBackground;
void* lpszMenuName;
void* lpszClassName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WNDCLASSW サイズ: 40 バイト(x86)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; style : WNDCLASS_STYLES (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lpfnWndProc : WNDPROC (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cbClsExtra : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cbWndExtra : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; hInstance : HINSTANCE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; hIcon : HICON (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; hCursor : HCURSOR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; hbrBackground : HBRUSH (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; lpszMenuName : LPWSTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lpszClassName : LPWSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WNDCLASSW サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; style : WNDCLASS_STYLES (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lpfnWndProc : WNDPROC (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbClsExtra : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cbWndExtra : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; hInstance : HINSTANCE (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; hIcon : HICON (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; hCursor : HCURSOR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; hbrBackground : HBRUSH (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; lpszMenuName : LPWSTR (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; lpszClassName : LPWSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WNDCLASSW
#field int style
#field intptr lpfnWndProc
#field int cbClsExtra
#field int cbWndExtra
#field intptr hInstance
#field intptr hIcon
#field intptr hCursor
#field intptr hbrBackground
#field intptr lpszMenuName
#field intptr lpszClassName
#endstruct
stdim st, WNDCLASSW ; NSTRUCT 変数を確保
st->style = 100
mes "style=" + st->style