Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › IMEPROW

IMEPROW

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

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

フィールド

フィールドサイズx64x86説明
hWndHWND8/4+0+0IMEに関連付けられたウィンドウのハンドル。
InstDateDATETIME12+8+4IMEのインストール日時を表すDATETIME。
wVersionDWORD4+20+16IMEのバージョン番号。
szDescriptionWCHAR100+24+20IMEの説明を表すWCHAR配列(Unicode)。
szNameWCHAR160+124+120IMEの名前を表すWCHAR配列(Unicode)。
szOptionsWCHAR60+284+280IMEのオプション情報を表すWCHAR配列(Unicode)。

各言語での定義

#include <windows.h>

// DATETIME  (x64 12 / x86 12 バイト)
typedef struct DATETIME {
    WORD year;
    WORD month;
    WORD day;
    WORD hour;
    WORD min;
    WORD sec;
} DATETIME;

// IMEPROW  (x64 344 / x86 340 バイト)
typedef struct IMEPROW {
    HWND hWnd;
    DATETIME InstDate;
    DWORD wVersion;
    WCHAR szDescription[50];
    WCHAR szName[80];
    WCHAR szOptions[30];
} IMEPROW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DATETIME
{
    public ushort year;
    public ushort month;
    public ushort day;
    public ushort hour;
    public ushort min;
    public ushort sec;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IMEPROW
{
    public IntPtr hWnd;
    public DATETIME InstDate;
    public uint wVersion;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)] public string szDescription;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] public string szName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)] public string szOptions;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DATETIME
    Public year As UShort
    Public month As UShort
    Public day As UShort
    Public hour As UShort
    Public min As UShort
    Public sec As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IMEPROW
    Public hWnd As IntPtr
    Public InstDate As DATETIME
    Public wVersion As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=50)> Public szDescription As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public szName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=30)> Public szOptions As String
End Structure
import ctypes
from ctypes import wintypes

class DATETIME(ctypes.Structure):
    _fields_ = [
        ("year", ctypes.c_ushort),
        ("month", ctypes.c_ushort),
        ("day", ctypes.c_ushort),
        ("hour", ctypes.c_ushort),
        ("min", ctypes.c_ushort),
        ("sec", ctypes.c_ushort),
    ]

class IMEPROW(ctypes.Structure):
    _fields_ = [
        ("hWnd", ctypes.c_void_p),
        ("InstDate", DATETIME),
        ("wVersion", wintypes.DWORD),
        ("szDescription", ctypes.c_wchar * 50),
        ("szName", ctypes.c_wchar * 80),
        ("szOptions", ctypes.c_wchar * 30),
    ]
#[repr(C)]
pub struct DATETIME {
    pub year: u16,
    pub month: u16,
    pub day: u16,
    pub hour: u16,
    pub min: u16,
    pub sec: u16,
}

#[repr(C)]
pub struct IMEPROW {
    pub hWnd: *mut core::ffi::c_void,
    pub InstDate: DATETIME,
    pub wVersion: u32,
    pub szDescription: [u16; 50],
    pub szName: [u16; 80],
    pub szOptions: [u16; 30],
}
import "golang.org/x/sys/windows"

type DATETIME struct {
	year uint16
	month uint16
	day uint16
	hour uint16
	min uint16
	sec uint16
}

type IMEPROW struct {
	hWnd uintptr
	InstDate DATETIME
	wVersion uint32
	szDescription [50]uint16
	szName [80]uint16
	szOptions [30]uint16
}
type
  DATETIME = record
    year: Word;
    month: Word;
    day: Word;
    hour: Word;
    min: Word;
    sec: Word;
  end;

  IMEPROW = record
    hWnd: Pointer;
    InstDate: DATETIME;
    wVersion: DWORD;
    szDescription: array[0..49] of WideChar;
    szName: array[0..79] of WideChar;
    szOptions: array[0..29] of WideChar;
  end;
const DATETIME = extern struct {
    year: u16,
    month: u16,
    day: u16,
    hour: u16,
    min: u16,
    sec: u16,
};

const IMEPROW = extern struct {
    hWnd: ?*anyopaque,
    InstDate: DATETIME,
    wVersion: u32,
    szDescription: [50]u16,
    szName: [80]u16,
    szOptions: [30]u16,
};
type
  DATETIME {.bycopy.} = object
    year: uint16
    month: uint16
    day: uint16
    hour: uint16
    min: uint16
    sec: uint16

  IMEPROW {.bycopy.} = object
    hWnd: pointer
    InstDate: DATETIME
    wVersion: uint32
    szDescription: array[50, uint16]
    szName: array[80, uint16]
    szOptions: array[30, uint16]
struct DATETIME
{
    ushort year;
    ushort month;
    ushort day;
    ushort hour;
    ushort min;
    ushort sec;
}

struct IMEPROW
{
    void* hWnd;
    DATETIME InstDate;
    uint wVersion;
    wchar[50] szDescription;
    wchar[80] szName;
    wchar[30] szOptions;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; IMEPROW サイズ: 340 バイト(x86)
dim st, 85    ; 4byte整数×85(構造体サイズ 340 / 4 切り上げ)
; hWnd : HWND (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; InstDate : DATETIME (+4, 12byte)  varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; wVersion : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; szDescription : WCHAR (+20, 100byte)  varptr(st)+20 を基点に操作(100byte:入れ子/配列)
; szName : WCHAR (+120, 160byte)  varptr(st)+120 を基点に操作(160byte:入れ子/配列)
; szOptions : WCHAR (+280, 60byte)  varptr(st)+280 を基点に操作(60byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IMEPROW サイズ: 344 バイト(x64)
dim st, 86    ; 4byte整数×86(構造体サイズ 344 / 4 切り上げ)
; hWnd : HWND (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; InstDate : DATETIME (+8, 12byte)  varptr(st)+8 を基点に操作(12byte:入れ子/配列)
; wVersion : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; szDescription : WCHAR (+24, 100byte)  varptr(st)+24 を基点に操作(100byte:入れ子/配列)
; szName : WCHAR (+124, 160byte)  varptr(st)+124 を基点に操作(160byte:入れ子/配列)
; szOptions : WCHAR (+284, 60byte)  varptr(st)+284 を基点に操作(60byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DATETIME
    #field short year
    #field short month
    #field short day
    #field short hour
    #field short min
    #field short sec
#endstruct

#defstruct global IMEPROW
    #field intptr hWnd
    #field DATETIME InstDate
    #field int wVersion
    #field wchar szDescription 50
    #field wchar szName 80
    #field wchar szOptions 30
#endstruct

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