ホーム › UI.Input.Ime › ImmSetCompositionStringW
ImmSetCompositionStringW
関数入力コンテキストの変換文字列や読み文字列を設定する(Unicode版)。
シグネチャ
// IMM32.dll (Unicode / -W)
#include <windows.h>
BOOL ImmSetCompositionStringW(
HIMC param0,
SET_COMPOSITION_STRING_TYPE dwIndex,
void* lpComp, // optional
DWORD dwCompLen,
void* lpRead, // optional
DWORD dwReadLen
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| param0 | HIMC | in |
| dwIndex | SET_COMPOSITION_STRING_TYPE | in |
| lpComp | void* | inoptional |
| dwCompLen | DWORD | in |
| lpRead | void* | inoptional |
| dwReadLen | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// IMM32.dll (Unicode / -W)
#include <windows.h>
BOOL ImmSetCompositionStringW(
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.Unicode, ExactSpelling = true)]
static extern bool ImmSetCompositionStringW(
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.Unicode, ExactSpelling:=True)>
Public Shared Function ImmSetCompositionStringW(
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 Boolean
End Function' param0 : HIMC
' dwIndex : SET_COMPOSITION_STRING_TYPE
' lpComp : void* optional
' dwCompLen : DWORD
' lpRead : void* optional
' dwReadLen : DWORD
Declare PtrSafe Function ImmSetCompositionStringW 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
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ImmSetCompositionStringW = ctypes.windll.imm32.ImmSetCompositionStringW
ImmSetCompositionStringW.restype = wintypes.BOOL
ImmSetCompositionStringW.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')
ImmSetCompositionStringW = Fiddle::Function.new(
lib['ImmSetCompositionStringW'],
[
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)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "imm32")]
extern "system" {
fn ImmSetCompositionStringW(
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.Unicode)]
public static extern bool ImmSetCompositionStringW(IntPtr param0, uint dwIndex, IntPtr lpComp, uint dwCompLen, IntPtr lpRead, uint dwReadLen);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IMM32_ImmSetCompositionStringW' -Namespace Win32 -PassThru
# $api::ImmSetCompositionStringW(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen)#uselib "IMM32.dll"
#func global ImmSetCompositionStringW "ImmSetCompositionStringW" wptr, wptr, wptr, wptr, wptr, wptr
; ImmSetCompositionStringW param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen ; 戻り値は stat
; param0 : HIMC -> "wptr"
; dwIndex : SET_COMPOSITION_STRING_TYPE -> "wptr"
; lpComp : void* optional -> "wptr"
; dwCompLen : DWORD -> "wptr"
; lpRead : void* optional -> "wptr"
; dwReadLen : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "IMM32.dll"
#cfunc global ImmSetCompositionStringW "ImmSetCompositionStringW" sptr, int, sptr, int, sptr, int
; res = ImmSetCompositionStringW(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 ImmSetCompositionStringW(HIMC param0, SET_COMPOSITION_STRING_TYPE dwIndex, void* lpComp, DWORD dwCompLen, void* lpRead, DWORD dwReadLen)
#uselib "IMM32.dll"
#cfunc global ImmSetCompositionStringW "ImmSetCompositionStringW" intptr, int, intptr, int, intptr, int
; res = ImmSetCompositionStringW(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")
procImmSetCompositionStringW = imm32.NewProc("ImmSetCompositionStringW")
)
// param0 (HIMC), dwIndex (SET_COMPOSITION_STRING_TYPE), lpComp (void* optional), dwCompLen (DWORD), lpRead (void* optional), dwReadLen (DWORD)
r1, _, err := procImmSetCompositionStringW.Call(
uintptr(param0),
uintptr(dwIndex),
uintptr(lpComp),
uintptr(dwCompLen),
uintptr(lpRead),
uintptr(dwReadLen),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ImmSetCompositionStringW(
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 'ImmSetCompositionStringW';result := DllCall("IMM32\ImmSetCompositionStringW"
, "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●ImmSetCompositionStringW(param0, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen) = DLL("IMM32.dll", "bool ImmSetCompositionStringW(void*, dword, void*, dword, void*, dword)")
# 呼び出し: ImmSetCompositionStringW(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)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。