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

ImmCreateContext

関数
新しい入力コンテキスト(HIMC)を作成する。
DLLIMM32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// IMM32.dll
#include <windows.h>

HIMC ImmCreateContext(void);

パラメーターなし。戻り値: HIMC

各言語での呼び出し定義

// IMM32.dll
#include <windows.h>

HIMC ImmCreateContext(void);
[DllImport("IMM32.dll", ExactSpelling = true)]
static extern IntPtr ImmCreateContext();
<DllImport("IMM32.dll", ExactSpelling:=True)>
Public Shared Function ImmCreateContext() As IntPtr
End Function
Declare PtrSafe Function ImmCreateContext Lib "imm32" () As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ImmCreateContext = ctypes.windll.imm32.ImmCreateContext
ImmCreateContext.restype = ctypes.c_void_p
ImmCreateContext.argtypes = []
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('IMM32.dll')
ImmCreateContext = Fiddle::Function.new(
  lib['ImmCreateContext'],
  [],
  Fiddle::TYPE_VOIDP)
#[link(name = "imm32")]
extern "system" {
    fn ImmCreateContext() -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("IMM32.dll")]
public static extern IntPtr ImmCreateContext();
"@
$api = Add-Type -MemberDefinition $sig -Name 'IMM32_ImmCreateContext' -Namespace Win32 -PassThru
# $api::ImmCreateContext()
#uselib "IMM32.dll"
#func global ImmCreateContext "ImmCreateContext"
; ImmCreateContext   ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "IMM32.dll"
#cfunc global ImmCreateContext "ImmCreateContext"
; res = ImmCreateContext()
; HIMC ImmCreateContext()
#uselib "IMM32.dll"
#cfunc global ImmCreateContext "ImmCreateContext"
; res = ImmCreateContext()
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	imm32 = windows.NewLazySystemDLL("IMM32.dll")
	procImmCreateContext = imm32.NewProc("ImmCreateContext")
)

r1, _, err := procImmCreateContext.Call()
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HIMC
function ImmCreateContext: THandle; stdcall;
  external 'IMM32.dll' name 'ImmCreateContext';
result := DllCall("IMM32\ImmCreateContext", "Ptr")
●ImmCreateContext() = DLL("IMM32.dll", "void* ImmCreateContext()")
# 呼び出し: ImmCreateContext()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。