{"id":928,"date":"2010-02-13T21:42:38","date_gmt":"2010-02-14T05:42:38","guid":{"rendered":"http:\/\/www.curlybrace.com\/words\/?p=928"},"modified":"2010-02-13T21:42:38","modified_gmt":"2010-02-14T05:42:38","slug":"ime-functions-fail-from-separate-process","status":"publish","type":"post","link":"https:\/\/www.curlybrace.com\/words\/2010\/02\/ime-functions-fail-from-separate-process\/","title":{"rendered":"IME Functions Fail From Separate Process"},"content":{"rendered":"<p>I wanted to change the behavior of the Microsoft IME bar using <a href=\"http:\/\/www.autohotkey.com\/\">AutoHotkeys<\/a>, a utility which can be used to create macros, remap keys, or do any of a variety of other related tasks.<\/p>\n<p>This led me to <a href=\"http:\/\/fw.ampll.org\/index.php?AutoHotKey\">ime_func.ahk<\/a>, which appears to be an AutoHotkeys script which uses DllCall to access Imm32.dll, the Input Method Manager library.  I believe that this script was intended to manipulate the state of the IME language bar.<\/p>\n<p>As near as I can tell, this AutoHotkeys script targets an older implementation of the IMM library.  Some of the methods used are now only listed for Windows Mobile platforms.<\/p>\n<p>I began experimenting with ImmGetContext and ImmGetConversionStatus.  ImmGetContext always returned a hIMC value of NULL.<\/p>\n<p>On the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd317789(VS.85).aspx\">Developing IME-Aware Multiple-thread Applications MSDN page<\/a>, the following is stated (bold highlight added):<\/p>\n<blockquote><p>The IMM includes thread identification checking that determines if a calling thread is the creator of a specified input method context handle (HIMC type) or window handle (HWND type). <b>If the thread is not the creator of the handle, the called IMM function fails and a subsequent call to GetLastError returns ERROR_INVALID_ACCESS.<\/b><\/p><\/blockquote>\n<p>Additionally:<\/p>\n<blockquote>\n<ul>\n<li \/>A thread should not access the input context created by another thread.\n<li \/>A thread should not associate an input context with a window created by another thread, and vice versa.<\/ul>\n<\/blockquote>\n<p>So, it appears that cross-process IME manipulation is forbidden.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to change the behavior of the Microsoft IME bar using AutoHotkeys, a utility which can be used to create macros, remap keys, or do any of a variety of other related tasks. This led me to ime_func.ahk, which &hellip; <a href=\"https:\/\/www.curlybrace.com\/words\/2010\/02\/ime-functions-fail-from-separate-process\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,283],"tags":[],"class_list":["post-928","post","type-post","status-publish","format-standard","hentry","category-technology","category-windows-technology"],"_links":{"self":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/comments?post=928"}],"version-history":[{"count":1,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/928\/revisions"}],"predecessor-version":[{"id":929,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/928\/revisions\/929"}],"wp:attachment":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/media?parent=928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/categories?post=928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/tags?post=928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}