Win32 API 日本語リファレンス
ホームUI.Controls.RichEdit › GETTEXTEX

GETTEXTEX

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

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

フィールド

フィールドサイズx64x86説明
cbDWORD4+0+0受信バッファのサイズをバイト単位で指定する。
flagsGETTEXTEX_FLAGS4+4+4テキスト取得の挙動を制御するフラグ群である。
codepageDWORD4+8+8取得テキストのコードページ。1200でUnicodeを示す。
lpDefaultCharLPSTR8/4+16+12Unicode変換不能文字に代用する既定文字を指定する。
lpUsedDefCharBOOL*8/4+24+16既定文字が使用されたかを返す真偽値ポインタである。NULL可。

各言語での定義

#include <windows.h>

// GETTEXTEX  (x64 32 / x86 20 バイト)
typedef struct GETTEXTEX {
    DWORD cb;
    GETTEXTEX_FLAGS flags;
    DWORD codepage;
    LPSTR lpDefaultChar;
    BOOL* lpUsedDefChar;
} GETTEXTEX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GETTEXTEX
{
    public uint cb;
    public uint flags;
    public uint codepage;
    public IntPtr lpDefaultChar;
    [MarshalAs(UnmanagedType.Bool)] public bool lpUsedDefChar;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GETTEXTEX
    Public cb As UInteger
    Public flags As UInteger
    Public codepage As UInteger
    Public lpDefaultChar As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public lpUsedDefChar As Boolean
End Structure
import ctypes
from ctypes import wintypes

class GETTEXTEX(ctypes.Structure):
    _fields_ = [
        ("cb", wintypes.DWORD),
        ("flags", wintypes.DWORD),
        ("codepage", wintypes.DWORD),
        ("lpDefaultChar", ctypes.c_void_p),
        ("lpUsedDefChar", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct GETTEXTEX {
    pub cb: u32,
    pub flags: u32,
    pub codepage: u32,
    pub lpDefaultChar: *mut core::ffi::c_void,
    pub lpUsedDefChar: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type GETTEXTEX struct {
	cb uint32
	flags uint32
	codepage uint32
	lpDefaultChar uintptr
	lpUsedDefChar uintptr
}
type
  GETTEXTEX = record
    cb: DWORD;
    flags: DWORD;
    codepage: DWORD;
    lpDefaultChar: Pointer;
    lpUsedDefChar: Pointer;
  end;
const GETTEXTEX = extern struct {
    cb: u32,
    flags: u32,
    codepage: u32,
    lpDefaultChar: ?*anyopaque,
    lpUsedDefChar: ?*anyopaque,
};
type
  GETTEXTEX {.bycopy.} = object
    cb: uint32
    flags: uint32
    codepage: uint32
    lpDefaultChar: pointer
    lpUsedDefChar: pointer
struct GETTEXTEX
{
    uint cb;
    uint flags;
    uint codepage;
    void* lpDefaultChar;
    void* lpUsedDefChar;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; GETTEXTEX サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; cb : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; flags : GETTEXTEX_FLAGS (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; codepage : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; lpDefaultChar : LPSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lpUsedDefChar : BOOL* (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GETTEXTEX サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; cb : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; flags : GETTEXTEX_FLAGS (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; codepage : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; lpDefaultChar : LPSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; lpUsedDefChar : BOOL* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GETTEXTEX
    #field int cb
    #field int flags
    #field int codepage
    #field intptr lpDefaultChar
    #field intptr lpUsedDefChar
#endstruct

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