Win32 API 日本語リファレンス
ホームUI.Input.Ime › ImmSetCompositionStringA

ImmSetCompositionStringA

関数
入力コンテキストの変換文字列や読み文字列を設定する(ANSI版)。
DLLIMM32.dll文字セットANSI (-A)呼出規約winapi対応OSWindows XP 以降

シグネチャ

// IMM32.dll  (ANSI / -A)
#include <windows.h>

BOOL ImmSetCompositionStringA(
    HIMC param0,
    SET_COMPOSITION_STRING_TYPE dwIndex,
    void* lpComp,   // optional
    DWORD dwCompLen,
    void* lpRead,   // optional
    DWORD dwReadLen
);

パラメーター

名前方向説明
param0HIMCin対象の入力コンテキストハンドル(HIMC)。
dwIndexSET_COMPOSITION_STRING_TYPEin

設定する情報の種類。このパラメーターには次のいずれかの値を指定できます。

意味
SCS_SETSTR
変換文字列、読み文字列、またはその両方を設定します。lpComplpRead のパラメーターのうち少なくとも一方に有効な文字列を指定する必要があります。いずれかの文字列が長すぎる場合、IME はそれを切り詰めます。
SCS_CHANGEATTR
変換文字列、読み文字列、またはその両方の属性を設定します。lpComplpRead のパラメーターのうち少なくとも一方に有効な属性配列を指定する必要があります。
SCS_CHANGECLAUSE
変換文字列、読み文字列、またはその両方の文節情報を設定します。lpComplpRead のパラメーターのうち少なくとも一方に有効な文節情報配列を指すよう指定する必要があります。
SCS_SETRECONVERTSTRING
Windows Me/98、Windows 2000、Windows XP: 指定した RECONVERTSTRING 構造体を使用して、IME に文字列の再変換を要求します。
SCS_QUERYRECONVERTSTRING
Windows Me/98、Windows 2000、Windows XP: IME に RECONVERTSTRING 構造体の調整を要求します。その後、アプリケーションは調整された構造体を SCS_SETRECONVERTSTRING を使用してこの関数に渡すことができます。IME は WM_IME_COMPOSITION メッセージを生成しません。
lpCompvoid*inoptionaldwIndex の値で指定された、変換文字列に設定する情報を格納したバッファーへのポインター。
dwCompLenDWORDin変換文字列用の情報バッファーのサイズ (バイト単位)。SCS_SETSTR が指定されており、バッファーに Unicode 文字列が格納されている場合でもバイト単位です。
lpReadvoid*inoptionaldwIndex の値で指定された、読み文字列に設定する情報を格納したバッファーへのポインター。アプリケーションはこのパラメーターに NULL を設定できます。
dwReadLenDWORDin読み文字列用の情報バッファーのサイズ (バイト単位)。SCS_SETSTR が指定されており、バッファーに Unicode 文字列が格納されている場合でもバイト単位です。

戻り値の型: BOOL

公式ドキュメント

ImmSetCompositionStringA (ANSI) 関数 (immdev.h) は、変換文字列および読み文字列の文字、属性、文節を設定します。

戻り値

成功した場合は 0 以外の値を返し、それ以外の場合は 0 を返します。

解説(Remarks)

アプリケーションは lpComplpRead、またはその両方を設定できます。lpComp の値を指定しない場合、このパラメーターを NULL に設定し、dwCompLen を 0 に設定する必要があります。

アプリケーションが属性を変更する場合、1 つの文節内のすべての文字は同じ属性を持つ必要があります。変換済みの文字は属性 ATTR_CONVERTED または ATTR_TARGET_CONVERTED を持つ必要があります。未変換の文字は属性 ATTR_INPUT または ATTR_TARGET_NOTCONVERTED を持つ必要があります。

アプリケーションが文節情報を変更する場合、変更できるのは対象文節のみであり、一度に 1 つの境界にのみ影響します。対象文節は属性 ATTR_TARGET_CONVERTED または ATTR_TARGET_NOTCONVERTED を持ちます。

属性 (ATTR_* の値) に関する追加情報については、Composition String を参照してください。

IME は変更を完了すると、変更を通知するために WM_IME_COMPOSITION メッセージをアプリケーションに送信します。

Windows Me/98、Windows 2000、Windows XP: SCS_*CONVERTSTRING の値は再変換に使用されます。これらは SCS_CAP_SETRECONVERTSTRING プロパティを持つ IME に対してのみ使用できます。アプリケーションはこれらの値を次のように使用します。

  1. ImmSetCompositionStringSCS_QUERYRECONVERTSTRING を指定して呼び出し、IME が再変換のために RECONVERTSTRING 構造体を調整するようにします。
  2. ImmSetCompositionStringSCS_SETRECONVERTSTRING を指定して呼び出し、IME が新しい変換文字列を生成するようにします。この後、lpComplpRead は、更新された変換文字列および読み文字列を格納した RECONVERTSTRING 構造体を指します。lpRead の値は、選択された IME に SCS_CAP_MAKEREAD が設定されている場合にのみ使用してください。
メモ

immdev.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして ImmSetCompositionString を定義します。エンコーディング非依存のエイリアスの使用と、エンコーディング非依存ではないコードとを混在させると、不一致が生じ、コンパイルエラーや実行時エラーを引き起こす可能性があります。詳細については、Conventions for Function Prototypes を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// IMM32.dll  (ANSI / -A)
#include <windows.h>

BOOL ImmSetCompositionStringA(
    HIMC param0,
    SET_COMPOSITION_STRING_TYPE dwIndex,
    void* lpComp,   // optional
    DWORD dwCompLen,
    void* lpRead,   // optional
    DWORD dwReadLen
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("IMM32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool ImmSetCompositionStringA(
    IntPtr param0,   // HIMC
    uint dwIndex,   // SET_COMPOSITION_STRING_TYPE
    IntPtr lpComp,   // void* optional
    uint dwCompLen,   // DWORD
    IntPtr lpRead,   // void* optional
    uint dwReadLen   // DWORD
);
<DllImport("IMM32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function ImmSetCompositionStringA(
    param0 As IntPtr,   ' HIMC
    dwIndex As UInteger,   ' SET_COMPOSITION_STRING_TYPE
    lpComp As IntPtr,   ' void* optional
    dwCompLen As UInteger,   ' DWORD
    lpRead As IntPtr,   ' void* optional
    dwReadLen As UInteger   ' DWORD
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' param0 : HIMC
' dwIndex : SET_COMPOSITION_STRING_TYPE
' lpComp : void* optional
' dwCompLen : DWORD
' lpRead : void* optional
' dwReadLen : DWORD
Declare PtrSafe Function ImmSetCompositionStringA Lib "imm32" ( _
    ByVal param0 As LongPtr, _
    ByVal dwIndex As Long, _
    ByVal lpComp As LongPtr, _
    ByVal dwCompLen As Long, _
    ByVal lpRead As LongPtr, _
    ByVal dwReadLen As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ImmSetCompositionStringA = ctypes.windll.imm32.ImmSetCompositionStringA
ImmSetCompositionStringA.restype = wintypes.BOOL
ImmSetCompositionStringA.argtypes = [
    wintypes.HANDLE,  # param0 : HIMC
    wintypes.DWORD,  # dwIndex : SET_COMPOSITION_STRING_TYPE
    ctypes.POINTER(None),  # lpComp : void* optional
    wintypes.DWORD,  # dwCompLen : DWORD
    ctypes.POINTER(None),  # lpRead : void* optional
    wintypes.DWORD,  # dwReadLen : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('IMM32.dll')
ImmSetCompositionStringA = Fiddle::Function.new(
  lib['ImmSetCompositionStringA'],
  [
    Fiddle::TYPE_VOIDP,  # param0 : HIMC
    -Fiddle::TYPE_INT,  # dwIndex : SET_COMPOSITION_STRING_TYPE
    Fiddle::TYPE_VOIDP,  # lpComp : void* optional
    -Fiddle::TYPE_INT,  # dwCompLen : DWORD
    Fiddle::TYPE_VOIDP,  # lpRead : void* optional
    -Fiddle::TYPE_INT,  # dwReadLen : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "imm32")]
extern "system" {
    fn ImmSetCompositionStringA(
        param0: *mut core::ffi::c_void,  // HIMC
        dwIndex: u32,  // SET_COMPOSITION_STRING_TYPE
        lpComp: *mut (),  // void* optional
        dwCompLen: u32,  // DWORD
        lpRead: *mut (),  // void* optional
        dwReadLen: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("IMM32.dll", CharSet = CharSet.Ansi)]
public static extern bool ImmSetCompositionStringA(IntPtr param0, uint dwIndex, IntPtr lpComp, uint dwCompLen, IntPtr lpRead, uint dwReadLen);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IMM32_ImmSetCompositionStringA' -Namespace Win32 -PassThru
# $api::ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)
#uselib "IMM32.dll"
#func global ImmSetCompositionStringA "ImmSetCompositionStringA" sptr, sptr, sptr, sptr, sptr, sptr
; ImmSetCompositionStringA param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen   ; 戻り値は stat
; param0 : HIMC -> "sptr"
; dwIndex : SET_COMPOSITION_STRING_TYPE -> "sptr"
; lpComp : void* optional -> "sptr"
; dwCompLen : DWORD -> "sptr"
; lpRead : void* optional -> "sptr"
; dwReadLen : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "IMM32.dll"
#cfunc global ImmSetCompositionStringA "ImmSetCompositionStringA" sptr, int, sptr, int, sptr, int
; res = ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)
; param0 : HIMC -> "sptr"
; dwIndex : SET_COMPOSITION_STRING_TYPE -> "int"
; lpComp : void* optional -> "sptr"
; dwCompLen : DWORD -> "int"
; lpRead : void* optional -> "sptr"
; dwReadLen : DWORD -> "int"
; BOOL ImmSetCompositionStringA(HIMC param0, SET_COMPOSITION_STRING_TYPE dwIndex, void* lpComp, DWORD dwCompLen, void* lpRead, DWORD dwReadLen)
#uselib "IMM32.dll"
#cfunc global ImmSetCompositionStringA "ImmSetCompositionStringA" intptr, int, intptr, int, intptr, int
; res = ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)
; param0 : HIMC -> "intptr"
; dwIndex : SET_COMPOSITION_STRING_TYPE -> "int"
; lpComp : void* optional -> "intptr"
; dwCompLen : DWORD -> "int"
; lpRead : void* optional -> "intptr"
; dwReadLen : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	imm32 = windows.NewLazySystemDLL("IMM32.dll")
	procImmSetCompositionStringA = imm32.NewProc("ImmSetCompositionStringA")
)

// param0 (HIMC), dwIndex (SET_COMPOSITION_STRING_TYPE), lpComp (void* optional), dwCompLen (DWORD), lpRead (void* optional), dwReadLen (DWORD)
r1, _, err := procImmSetCompositionStringA.Call(
	uintptr(param0),
	uintptr(dwIndex),
	uintptr(lpComp),
	uintptr(dwCompLen),
	uintptr(lpRead),
	uintptr(dwReadLen),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function ImmSetCompositionStringA(
  param0: THandle;   // HIMC
  dwIndex: DWORD;   // SET_COMPOSITION_STRING_TYPE
  lpComp: Pointer;   // void* optional
  dwCompLen: DWORD;   // DWORD
  lpRead: Pointer;   // void* optional
  dwReadLen: DWORD   // DWORD
): BOOL; stdcall;
  external 'IMM32.dll' name 'ImmSetCompositionStringA';
result := DllCall("IMM32\ImmSetCompositionStringA"
    , "Ptr", param0   ; HIMC
    , "UInt", dwIndex   ; SET_COMPOSITION_STRING_TYPE
    , "Ptr", lpComp   ; void* optional
    , "UInt", dwCompLen   ; DWORD
    , "Ptr", lpRead   ; void* optional
    , "UInt", dwReadLen   ; DWORD
    , "Int")   ; return: BOOL
●ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen) = DLL("IMM32.dll", "bool ImmSetCompositionStringA(void*, dword, void*, dword, void*, dword)")
# 呼び出し: ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)
# param0 : HIMC -> "void*"
# dwIndex : SET_COMPOSITION_STRING_TYPE -> "dword"
# lpComp : void* optional -> "void*"
# dwCompLen : DWORD -> "dword"
# lpRead : void* optional -> "void*"
# dwReadLen : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "imm32" fn ImmSetCompositionStringA(
    param0: ?*anyopaque, // HIMC
    dwIndex: u32, // SET_COMPOSITION_STRING_TYPE
    lpComp: ?*anyopaque, // void* optional
    dwCompLen: u32, // DWORD
    lpRead: ?*anyopaque, // void* optional
    dwReadLen: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;
proc ImmSetCompositionStringA(
    param0: pointer,  # HIMC
    dwIndex: uint32,  # SET_COMPOSITION_STRING_TYPE
    lpComp: pointer,  # void* optional
    dwCompLen: uint32,  # DWORD
    lpRead: pointer,  # void* optional
    dwReadLen: uint32  # DWORD
): int32 {.importc: "ImmSetCompositionStringA", stdcall, dynlib: "IMM32.dll".}
pragma(lib, "imm32");
extern(Windows)
int ImmSetCompositionStringA(
    void* param0,   // HIMC
    uint dwIndex,   // SET_COMPOSITION_STRING_TYPE
    void* lpComp,   // void* optional
    uint dwCompLen,   // DWORD
    void* lpRead,   // void* optional
    uint dwReadLen   // DWORD
);
ccall((:ImmSetCompositionStringA, "IMM32.dll"), stdcall, Int32,
      (Ptr{Cvoid}, UInt32, Ptr{Cvoid}, UInt32, Ptr{Cvoid}, UInt32),
      param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)
# param0 : HIMC -> Ptr{Cvoid}
# dwIndex : SET_COMPOSITION_STRING_TYPE -> UInt32
# lpComp : void* optional -> Ptr{Cvoid}
# dwCompLen : DWORD -> UInt32
# lpRead : void* optional -> Ptr{Cvoid}
# dwReadLen : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t ImmSetCompositionStringA(
    void* param0,
    uint32_t dwIndex,
    void* lpComp,
    uint32_t dwCompLen,
    void* lpRead,
    uint32_t dwReadLen);
]]
local imm32 = ffi.load("imm32")
-- imm32.ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)
-- param0 : HIMC
-- dwIndex : SET_COMPOSITION_STRING_TYPE
-- lpComp : void* optional
-- dwCompLen : DWORD
-- lpRead : void* optional
-- dwReadLen : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('IMM32.dll');
const ImmSetCompositionStringA = lib.func('__stdcall', 'ImmSetCompositionStringA', 'int32_t', ['void *', 'uint32_t', 'void *', 'uint32_t', 'void *', 'uint32_t']);
// ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)
// param0 : HIMC -> 'void *'
// dwIndex : SET_COMPOSITION_STRING_TYPE -> 'uint32_t'
// lpComp : void* optional -> 'void *'
// dwCompLen : DWORD -> 'uint32_t'
// lpRead : void* optional -> 'void *'
// dwReadLen : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("IMM32.dll", {
  ImmSetCompositionStringA: { parameters: ["pointer", "u32", "pointer", "u32", "pointer", "u32"], result: "i32" },
});
// lib.symbols.ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)
// param0 : HIMC -> "pointer"
// dwIndex : SET_COMPOSITION_STRING_TYPE -> "u32"
// lpComp : void* optional -> "pointer"
// dwCompLen : DWORD -> "u32"
// lpRead : void* optional -> "pointer"
// dwReadLen : DWORD -> "u32"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t ImmSetCompositionStringA(
    void* param0,
    uint32_t dwIndex,
    void* lpComp,
    uint32_t dwCompLen,
    void* lpRead,
    uint32_t dwReadLen);
C, "IMM32.dll");
// $ffi->ImmSetCompositionStringA(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
// param0 : HIMC
// dwIndex : SET_COMPOSITION_STRING_TYPE
// lpComp : void* optional
// dwCompLen : DWORD
// lpRead : void* optional
// dwReadLen : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Imm32 extends StdCallLibrary {
    Imm32 INSTANCE = Native.load("imm32", Imm32.class, W32APIOptions.ASCII_OPTIONS);
    boolean ImmSetCompositionStringA(
        Pointer param0,   // HIMC
        int dwIndex,   // SET_COMPOSITION_STRING_TYPE
        Pointer lpComp,   // void* optional
        int dwCompLen,   // DWORD
        Pointer lpRead,   // void* optional
        int dwReadLen   // DWORD
    );
}
@[Link("imm32")]
lib LibIMM32
  fun ImmSetCompositionStringA = ImmSetCompositionStringA(
    param0 : Void*,   # HIMC
    dwIndex : UInt32,   # SET_COMPOSITION_STRING_TYPE
    lpComp : Void*,   # void* optional
    dwCompLen : UInt32,   # DWORD
    lpRead : Void*,   # void* optional
    dwReadLen : UInt32   # DWORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ImmSetCompositionStringANative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>, Uint32, Pointer<Void>, Uint32);
typedef ImmSetCompositionStringADart = int Function(Pointer<Void>, int, Pointer<Void>, int, Pointer<Void>, int);
final ImmSetCompositionStringA = DynamicLibrary.open('IMM32.dll')
    .lookupFunction<ImmSetCompositionStringANative, ImmSetCompositionStringADart>('ImmSetCompositionStringA');
// param0 : HIMC -> Pointer<Void>
// dwIndex : SET_COMPOSITION_STRING_TYPE -> Uint32
// lpComp : void* optional -> Pointer<Void>
// dwCompLen : DWORD -> Uint32
// lpRead : void* optional -> Pointer<Void>
// dwReadLen : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ImmSetCompositionStringA(
  param0: THandle;   // HIMC
  dwIndex: DWORD;   // SET_COMPOSITION_STRING_TYPE
  lpComp: Pointer;   // void* optional
  dwCompLen: DWORD;   // DWORD
  lpRead: Pointer;   // void* optional
  dwReadLen: DWORD   // DWORD
): BOOL; stdcall;
  external 'IMM32.dll' name 'ImmSetCompositionStringA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ImmSetCompositionStringA"
  c_ImmSetCompositionStringA :: Ptr () -> Word32 -> Ptr () -> Word32 -> Ptr () -> Word32 -> IO CInt
-- param0 : HIMC -> Ptr ()
-- dwIndex : SET_COMPOSITION_STRING_TYPE -> Word32
-- lpComp : void* optional -> Ptr ()
-- dwCompLen : DWORD -> Word32
-- lpRead : void* optional -> Ptr ()
-- dwReadLen : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let immsetcompositionstringa =
  foreign "ImmSetCompositionStringA"
    ((ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> returning int32_t)
(* param0 : HIMC -> (ptr void) *)
(* dwIndex : SET_COMPOSITION_STRING_TYPE -> uint32_t *)
(* lpComp : void* optional -> (ptr void) *)
(* dwCompLen : DWORD -> uint32_t *)
(* lpRead : void* optional -> (ptr void) *)
(* dwReadLen : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library imm32 (t "IMM32.dll"))
(cffi:use-foreign-library imm32)

(cffi:defcfun ("ImmSetCompositionStringA" imm-set-composition-string-a :convention :stdcall) :int32
  (param0 :pointer)   ; HIMC
  (dw-index :uint32)   ; SET_COMPOSITION_STRING_TYPE
  (lp-comp :pointer)   ; void* optional
  (dw-comp-len :uint32)   ; DWORD
  (lp-read :pointer)   ; void* optional
  (dw-read-len :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ImmSetCompositionStringA = Win32::API::More->new('IMM32',
    'BOOL ImmSetCompositionStringA(HANDLE param0, DWORD dwIndex, LPVOID lpComp, DWORD dwCompLen, LPVOID lpRead, DWORD dwReadLen)');
# my $ret = $ImmSetCompositionStringA->Call($param0, $dwIndex, $lpComp, $dwCompLen, $lpRead, $dwReadLen);
# param0 : HIMC -> HANDLE
# dwIndex : SET_COMPOSITION_STRING_TYPE -> DWORD
# lpComp : void* optional -> LPVOID
# dwCompLen : DWORD -> DWORD
# lpRead : void* optional -> LPVOID
# dwReadLen : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

文字セット違い
公式の関連項目
使用する型