ホーム › System.Ole › OLECMDTEXT
OLECMDTEXT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cmdtextf | DWORD | 4 | +0 | +0 | 要求するテキスト種別フラグ(OLECMDTEXTF値)である。名称か状態かを指定する。 |
| cwActual | DWORD | 4 | +4 | +4 | rgwzへ実際に書き込まれた文字数を表す。 |
| cwBuf | DWORD | 4 | +8 | +8 | rgwzバッファの文字数容量を表す。 |
| rgwz | WCHAR | 2 | +12 | +12 | コマンドの名称または状態テキストを格納する可変長文字バッファである。 |
各言語での定義
#include <windows.h>
// OLECMDTEXT (x64 16 / x86 16 バイト)
typedef struct OLECMDTEXT {
DWORD cmdtextf;
DWORD cwActual;
DWORD cwBuf;
WCHAR rgwz[1];
} OLECMDTEXT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OLECMDTEXT
{
public uint cmdtextf;
public uint cwActual;
public uint cwBuf;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string rgwz;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OLECMDTEXT
Public cmdtextf As UInteger
Public cwActual As UInteger
Public cwBuf As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public rgwz As String
End Structureimport ctypes
from ctypes import wintypes
class OLECMDTEXT(ctypes.Structure):
_fields_ = [
("cmdtextf", wintypes.DWORD),
("cwActual", wintypes.DWORD),
("cwBuf", wintypes.DWORD),
("rgwz", ctypes.c_wchar * 1),
]#[repr(C)]
pub struct OLECMDTEXT {
pub cmdtextf: u32,
pub cwActual: u32,
pub cwBuf: u32,
pub rgwz: [u16; 1],
}import "golang.org/x/sys/windows"
type OLECMDTEXT struct {
cmdtextf uint32
cwActual uint32
cwBuf uint32
rgwz [1]uint16
}type
OLECMDTEXT = record
cmdtextf: DWORD;
cwActual: DWORD;
cwBuf: DWORD;
rgwz: array[0..0] of WideChar;
end;const OLECMDTEXT = extern struct {
cmdtextf: u32,
cwActual: u32,
cwBuf: u32,
rgwz: [1]u16,
};type
OLECMDTEXT {.bycopy.} = object
cmdtextf: uint32
cwActual: uint32
cwBuf: uint32
rgwz: array[1, uint16]struct OLECMDTEXT
{
uint cmdtextf;
uint cwActual;
uint cwBuf;
wchar[1] rgwz;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OLECMDTEXT サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; cmdtextf : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cwActual : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cwBuf : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; rgwz : WCHAR (+12, 2byte) varptr(st)+12 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global OLECMDTEXT
#field int cmdtextf
#field int cwActual
#field int cwBuf
#field wchar rgwz 1
#endstruct
stdim st, OLECMDTEXT ; NSTRUCT 変数を確保
st->cmdtextf = 100
mes "cmdtextf=" + st->cmdtextf