Win32 API 日本語リファレンス
ホームUI.Input.Ime › STYLEBUFW

STYLEBUFW

構造体
サイズx64: 68 バイト / x86: 68 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwStyleDWORD4+0+0登録単語の品詞スタイルを示す値である。
szDescriptionWCHAR64+4+4スタイルの説明を示すUnicode文字列バッファである。

各言語での定義

#include <windows.h>

// STYLEBUFW  (x64 68 / x86 68 バイト)
typedef struct STYLEBUFW {
    DWORD dwStyle;
    WCHAR szDescription[32];
} STYLEBUFW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STYLEBUFW
{
    public uint dwStyle;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szDescription;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STYLEBUFW
    Public dwStyle As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public szDescription As String
End Structure
import ctypes
from ctypes import wintypes

class STYLEBUFW(ctypes.Structure):
    _fields_ = [
        ("dwStyle", wintypes.DWORD),
        ("szDescription", ctypes.c_wchar * 32),
    ]
#[repr(C)]
pub struct STYLEBUFW {
    pub dwStyle: u32,
    pub szDescription: [u16; 32],
}
import "golang.org/x/sys/windows"

type STYLEBUFW struct {
	dwStyle uint32
	szDescription [32]uint16
}
type
  STYLEBUFW = record
    dwStyle: DWORD;
    szDescription: array[0..31] of WideChar;
  end;
const STYLEBUFW = extern struct {
    dwStyle: u32,
    szDescription: [32]u16,
};
type
  STYLEBUFW {.bycopy.} = object
    dwStyle: uint32
    szDescription: array[32, uint16]
struct STYLEBUFW
{
    uint dwStyle;
    wchar[32] szDescription;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STYLEBUFW サイズ: 68 バイト(x64)
dim st, 17    ; 4byte整数×17(構造体サイズ 68 / 4 切り上げ)
; dwStyle : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; szDescription : WCHAR (+4, 64byte)  varptr(st)+4 を基点に操作(64byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STYLEBUFW
    #field int dwStyle
    #field wchar szDescription 32
#endstruct

stdim st, STYLEBUFW        ; NSTRUCT 変数を確保
st->dwStyle = 100
mes "dwStyle=" + st->dwStyle