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

IMEPROA

構造体
サイズx64: 184 バイト / x86: 180 バイト

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

フィールド

フィールドサイズx64x86説明
hWndHWND8/4+0+0IMEに関連付けられたウィンドウのハンドル。
InstDateDATETIME12+8+4IMEのインストール日時を表すDATETIME。
wVersionDWORD4+20+16IMEのバージョン番号。
szDescriptionBYTE50+24+20IMEの説明を表すバイト配列(ANSI)。
szNameBYTE80+74+70IMEの名前を表すバイト配列(ANSI)。
szOptionsBYTE30+154+150IMEのオプション情報を表すバイト配列(ANSI)。

各言語での定義

#include <windows.h>

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

// IMEPROA  (x64 184 / x86 180 バイト)
typedef struct IMEPROA {
    HWND hWnd;
    DATETIME InstDate;
    DWORD wVersion;
    BYTE szDescription[50];
    BYTE szName[80];
    BYTE szOptions[30];
} IMEPROA;
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 IMEPROA
{
    public IntPtr hWnd;
    public DATETIME InstDate;
    public uint wVersion;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] public byte[] szDescription;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] szName;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] public byte[] 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 IMEPROA
    Public hWnd As IntPtr
    Public InstDate As DATETIME
    Public wVersion As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=50)> Public szDescription() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=80)> Public szName() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=30)> Public szOptions() As Byte
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 IMEPROA(ctypes.Structure):
    _fields_ = [
        ("hWnd", ctypes.c_void_p),
        ("InstDate", DATETIME),
        ("wVersion", wintypes.DWORD),
        ("szDescription", ctypes.c_ubyte * 50),
        ("szName", ctypes.c_ubyte * 80),
        ("szOptions", ctypes.c_ubyte * 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 IMEPROA {
    pub hWnd: *mut core::ffi::c_void,
    pub InstDate: DATETIME,
    pub wVersion: u32,
    pub szDescription: [u8; 50],
    pub szName: [u8; 80],
    pub szOptions: [u8; 30],
}
import "golang.org/x/sys/windows"

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

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

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

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

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

struct IMEPROA
{
    void* hWnd;
    DATETIME InstDate;
    uint wVersion;
    ubyte[50] szDescription;
    ubyte[80] szName;
    ubyte[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 レイアウト)
; IMEPROA サイズ: 180 バイト(x86)
dim st, 45    ; 4byte整数×45(構造体サイズ 180 / 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 : BYTE (+20, 50byte)  varptr(st)+20 を基点に操作(50byte:入れ子/配列)
; szName : BYTE (+70, 80byte)  varptr(st)+70 を基点に操作(80byte:入れ子/配列)
; szOptions : BYTE (+150, 30byte)  varptr(st)+150 を基点に操作(30byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IMEPROA サイズ: 184 バイト(x64)
dim st, 46    ; 4byte整数×46(構造体サイズ 184 / 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 : BYTE (+24, 50byte)  varptr(st)+24 を基点に操作(50byte:入れ子/配列)
; szName : BYTE (+74, 80byte)  varptr(st)+74 を基点に操作(80byte:入れ子/配列)
; szOptions : BYTE (+154, 30byte)  varptr(st)+154 を基点に操作(30byte:入れ子/配列)
; ※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 IMEPROA
    #field intptr hWnd
    #field DATETIME InstDate
    #field int wVersion
    #field byte szDescription 50
    #field byte szName 80
    #field byte szOptions 30
#endstruct

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