ホーム › UI.Shell.Common › STRRET
STRRET
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| uType | DWORD | 4 | +0 | +0 | 返却される文字列の格納形式。STRRET_WSTR・STRRET_OFFSET・STRRET_CSTRのいずれか。 |
| Anonymous | _Anonymous_e__Union | 264/260 | +8 | +4 | uTypeに応じた文字列データを格納する共用体。ポインタ・オフセット・固定バッファ。 |
共用体: _Anonymous_e__Union x64 264B / x86 260B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| pOleStr | LPWSTR | 8/4 | +0 | +0 |
| uOffset | DWORD | 4 | +0 | +0 |
| cStr | BYTE | 260 | +0 | +0 |
各言語での定義
#include <windows.h>
// STRRET (x64 272 / x86 264 バイト)
typedef struct STRRET {
DWORD uType;
_Anonymous_e__Union Anonymous;
} STRRET;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STRRET
{
public uint uType;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STRRET
Public uType As UInteger
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class STRRET(ctypes.Structure):
_fields_ = [
("uType", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct STRRET {
pub uType: u32,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type STRRET struct {
uType uint32
Anonymous _Anonymous_e__Union
}type
STRRET = record
uType: DWORD;
Anonymous: _Anonymous_e__Union;
end;const STRRET = extern struct {
uType: u32,
Anonymous: _Anonymous_e__Union,
};type
STRRET {.bycopy.} = object
uType: uint32
Anonymous: _Anonymous_e__Unionstruct STRRET
{
uint uType;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STRRET サイズ: 264 バイト(x86)
dim st, 66 ; 4byte整数×66(構造体サイズ 264 / 4 切り上げ)
; uType : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+4, 260byte) varptr(st)+4 を基点に操作(260byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STRRET サイズ: 272 バイト(x64)
dim st, 68 ; 4byte整数×68(構造体サイズ 272 / 4 切り上げ)
; uType : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+8, 264byte) varptr(st)+8 を基点に操作(264byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STRRET
#field int uType
#field byte Anonymous 264
#endstruct
stdim st, STRRET ; NSTRUCT 変数を確保
st->uType = 100
mes "uType=" + st->uType
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。