ホーム › UI.Input.Ime › ImmAssociateContextEx
ImmAssociateContextEx
関数フラグ指定でウィンドウに入力コンテキストを関連付ける拡張版。
シグネチャ
// IMM32.dll
#include <windows.h>
BOOL ImmAssociateContextEx(
HWND param0,
HIMC param1,
DWORD param2
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| param0 | HWND | in |
| param1 | HIMC | in |
| param2 | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// IMM32.dll
#include <windows.h>
BOOL ImmAssociateContextEx(
HWND param0,
HIMC param1,
DWORD param2
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("IMM32.dll", ExactSpelling = true)]
static extern bool ImmAssociateContextEx(
IntPtr param0, // HWND
IntPtr param1, // HIMC
uint param2 // DWORD
);<DllImport("IMM32.dll", ExactSpelling:=True)>
Public Shared Function ImmAssociateContextEx(
param0 As IntPtr, ' HWND
param1 As IntPtr, ' HIMC
param2 As UInteger ' DWORD
) As Boolean
End Function' param0 : HWND
' param1 : HIMC
' param2 : DWORD
Declare PtrSafe Function ImmAssociateContextEx Lib "imm32" ( _
ByVal param0 As LongPtr, _
ByVal param1 As LongPtr, _
ByVal param2 As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ImmAssociateContextEx = ctypes.windll.imm32.ImmAssociateContextEx
ImmAssociateContextEx.restype = wintypes.BOOL
ImmAssociateContextEx.argtypes = [
wintypes.HANDLE, # param0 : HWND
wintypes.HANDLE, # param1 : HIMC
wintypes.DWORD, # param2 : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('IMM32.dll')
ImmAssociateContextEx = Fiddle::Function.new(
lib['ImmAssociateContextEx'],
[
Fiddle::TYPE_VOIDP, # param0 : HWND
Fiddle::TYPE_VOIDP, # param1 : HIMC
-Fiddle::TYPE_INT, # param2 : DWORD
],
Fiddle::TYPE_INT)#[link(name = "imm32")]
extern "system" {
fn ImmAssociateContextEx(
param0: *mut core::ffi::c_void, // HWND
param1: *mut core::ffi::c_void, // HIMC
param2: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("IMM32.dll")]
public static extern bool ImmAssociateContextEx(IntPtr param0, IntPtr param1, uint param2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IMM32_ImmAssociateContextEx' -Namespace Win32 -PassThru
# $api::ImmAssociateContextEx(param0, param1, param2)#uselib "IMM32.dll"
#func global ImmAssociateContextEx "ImmAssociateContextEx" sptr, sptr, sptr
; ImmAssociateContextEx param0, param1, param2 ; 戻り値は stat
; param0 : HWND -> "sptr"
; param1 : HIMC -> "sptr"
; param2 : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "IMM32.dll"
#cfunc global ImmAssociateContextEx "ImmAssociateContextEx" sptr, sptr, int
; res = ImmAssociateContextEx(param0, param1, param2)
; param0 : HWND -> "sptr"
; param1 : HIMC -> "sptr"
; param2 : DWORD -> "int"; BOOL ImmAssociateContextEx(HWND param0, HIMC param1, DWORD param2)
#uselib "IMM32.dll"
#cfunc global ImmAssociateContextEx "ImmAssociateContextEx" intptr, intptr, int
; res = ImmAssociateContextEx(param0, param1, param2)
; param0 : HWND -> "intptr"
; param1 : HIMC -> "intptr"
; param2 : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
imm32 = windows.NewLazySystemDLL("IMM32.dll")
procImmAssociateContextEx = imm32.NewProc("ImmAssociateContextEx")
)
// param0 (HWND), param1 (HIMC), param2 (DWORD)
r1, _, err := procImmAssociateContextEx.Call(
uintptr(param0),
uintptr(param1),
uintptr(param2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ImmAssociateContextEx(
param0: THandle; // HWND
param1: THandle; // HIMC
param2: DWORD // DWORD
): BOOL; stdcall;
external 'IMM32.dll' name 'ImmAssociateContextEx';result := DllCall("IMM32\ImmAssociateContextEx"
, "Ptr", param0 ; HWND
, "Ptr", param1 ; HIMC
, "UInt", param2 ; DWORD
, "Int") ; return: BOOL●ImmAssociateContextEx(param0, param1, param2) = DLL("IMM32.dll", "bool ImmAssociateContextEx(void*, void*, dword)")
# 呼び出し: ImmAssociateContextEx(param0, param1, param2)
# param0 : HWND -> "void*"
# param1 : HIMC -> "void*"
# param2 : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。