ホーム › System.WindowsProgramming › STRINGEXSTRUCT
STRINGEXSTRUCT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のサイズ(バイト)。 |
| uDeterminePos | DWORD | 4 | +4 | +4 | 確定文字列の位置(オフセット)。 |
| uDetermineDelimPos | DWORD | 4 | +8 | +8 | 確定文字列の区切り位置。 |
| uYomiPos | DWORD | 4 | +12 | +12 | 読み文字列の位置(オフセット)。 |
| uYomiDelimPos | DWORD | 4 | +16 | +16 | 読み文字列の区切り位置。 |
各言語での定義
#include <windows.h>
// STRINGEXSTRUCT (x64 20 / x86 20 バイト)
typedef struct STRINGEXSTRUCT {
DWORD dwSize;
DWORD uDeterminePos;
DWORD uDetermineDelimPos;
DWORD uYomiPos;
DWORD uYomiDelimPos;
} STRINGEXSTRUCT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STRINGEXSTRUCT
{
public uint dwSize;
public uint uDeterminePos;
public uint uDetermineDelimPos;
public uint uYomiPos;
public uint uYomiDelimPos;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STRINGEXSTRUCT
Public dwSize As UInteger
Public uDeterminePos As UInteger
Public uDetermineDelimPos As UInteger
Public uYomiPos As UInteger
Public uYomiDelimPos As UInteger
End Structureimport ctypes
from ctypes import wintypes
class STRINGEXSTRUCT(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("uDeterminePos", wintypes.DWORD),
("uDetermineDelimPos", wintypes.DWORD),
("uYomiPos", wintypes.DWORD),
("uYomiDelimPos", wintypes.DWORD),
]#[repr(C)]
pub struct STRINGEXSTRUCT {
pub dwSize: u32,
pub uDeterminePos: u32,
pub uDetermineDelimPos: u32,
pub uYomiPos: u32,
pub uYomiDelimPos: u32,
}import "golang.org/x/sys/windows"
type STRINGEXSTRUCT struct {
dwSize uint32
uDeterminePos uint32
uDetermineDelimPos uint32
uYomiPos uint32
uYomiDelimPos uint32
}type
STRINGEXSTRUCT = record
dwSize: DWORD;
uDeterminePos: DWORD;
uDetermineDelimPos: DWORD;
uYomiPos: DWORD;
uYomiDelimPos: DWORD;
end;const STRINGEXSTRUCT = extern struct {
dwSize: u32,
uDeterminePos: u32,
uDetermineDelimPos: u32,
uYomiPos: u32,
uYomiDelimPos: u32,
};type
STRINGEXSTRUCT {.bycopy.} = object
dwSize: uint32
uDeterminePos: uint32
uDetermineDelimPos: uint32
uYomiPos: uint32
uYomiDelimPos: uint32struct STRINGEXSTRUCT
{
uint dwSize;
uint uDeterminePos;
uint uDetermineDelimPos;
uint uYomiPos;
uint uYomiDelimPos;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STRINGEXSTRUCT サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; uDeterminePos : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; uDetermineDelimPos : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; uYomiPos : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; uYomiDelimPos : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STRINGEXSTRUCT
#field int dwSize
#field int uDeterminePos
#field int uDetermineDelimPos
#field int uYomiPos
#field int uYomiDelimPos
#endstruct
stdim st, STRINGEXSTRUCT ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize