Hello
I have confirmed that I can not input Hangul characters with PostMessage or SendMessage.
However, I found that using the "keybd_event" function, I can input Hangul characters.
I would like to output the Hangul in the code of "SendKeysToWindow" Function by modifying the source below.
Below is a source to replace English with Korean.
Can I add the following code so that I can input Hangul?
------------------------------------------------------------------------------
void NewTypingMessageFromCodePage(TCHAR* Message, UINT CodePage=0)
{
TCHAR Word[2];
TCHAR WordCode[64];
char MultiByte[64];
static const BYTE NumCode[10]={0x2D, 0x23, 0x28, 0x22, 0x25, 0x0C, 0x27, 0x24, 0x26, 0x21};
int Length = wcslen(Message);
for(int i=0; i<Length; i++)
{
Word[0] = Message[i];
Word[1] = L'\0';
WideCharToMultiByte(CodePage, 0, Word, -1, MultiByte, 64, NULL, NULL);
_itow((int)(((~MultiByte[0])^0xff)<<8)+((~MultiByte[1])^0xff), WordCode, 10);
keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), 0, 0);
for(int j=0; j<wcslen(WordCode); j++)
{
keybd_event(NumCode[(int)WordCode[j]-48], MapVirtualKey(NumCode[(int)WordCode[j]-48], 0), 0, 0);
keybd_event(NumCode[(int)WordCode[j]-48], MapVirtualKey(NumCode[(int)WordCode[j]-48], 0), KEYEVENTF_KEYUP, 0);
}
keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), KEYEVENTF_KEYUP, 0);
}
}
<SPAN id=tx_marker_caret></SPAN>
OR
http://boongubbang.tistory.com/253?category=200923
http://boongubbang.tistory.com/255?category=200923
Function SendKeysToWindow
I have confirmed that I can not input Hangul characters with PostMessage or SendMessage.
However, I found that using the "keybd_event" function, I can input Hangul characters.
I would like to output the Hangul in the code of "SendKeysToWindow" Function by modifying the source below.
Below is a source to replace English with Korean.
Can I add the following code so that I can input Hangul?
------------------------------------------------------------------------------
void NewTypingMessageFromCodePage(TCHAR* Message, UINT CodePage=0)
{
TCHAR Word[2];
TCHAR WordCode[64];
char MultiByte[64];
static const BYTE NumCode[10]={0x2D, 0x23, 0x28, 0x22, 0x25, 0x0C, 0x27, 0x24, 0x26, 0x21};
int Length = wcslen(Message);
for(int i=0; i<Length; i++)
{
Word[0] = Message[i];
Word[1] = L'\0';
WideCharToMultiByte(CodePage, 0, Word, -1, MultiByte, 64, NULL, NULL);
_itow((int)(((~MultiByte[0])^0xff)<<8)+((~MultiByte[1])^0xff), WordCode, 10);
keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), 0, 0);
for(int j=0; j<wcslen(WordCode); j++)
{
keybd_event(NumCode[(int)WordCode[j]-48], MapVirtualKey(NumCode[(int)WordCode[j]-48], 0), 0, 0);
keybd_event(NumCode[(int)WordCode[j]-48], MapVirtualKey(NumCode[(int)WordCode[j]-48], 0), KEYEVENTF_KEYUP, 0);
}
keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), KEYEVENTF_KEYUP, 0);
}
}
<SPAN id=tx_marker_caret></SPAN>
OR
http://boongubbang.tistory.com/253?category=200923
http://boongubbang.tistory.com/255?category=200923
Function SendKeysToWindow
;/
function hwnd ARRAY(KEYEVENT)'a
;Sends keys to a child window using WM_KEYDOWN/WM_KEYUP messages.
;The window can be inactive.
;The function actually presses modifier keys (Shift, Ctrl, Alt), although very briefly.
;hwnd - child window handle.
;a - the key function.
;EXAMPLE
;int hwnd=id(15 "Notepad")
;SendKeysToWindow hwnd key("Line1[]Line2[]")
int i lparam m up alt
ifk(A) alt=1
for i 0 a.len
,KEYEVENT k=a[i]
,
,if(k.flags&0x80) ;;wait
,,i+1
,,opt waitmsg -1
,,wait (a[i].wt/1000.0)
,,continue
,
,lparam=k.sc<<16|1
,if(k.flags&KEYEVENTF_EXTENDEDKEY) lparam|0x01000000
,if(k.flags&KEYEVENTF_KEYUP) lparam|0xC0000000; up=1; else up=0
,
,if(alt) m=iif(up WM_SYSKEYUP WM_SYSKEYDOWN); lparam|0x20000000
,else m=iif(up WM_KEYUP WM_KEYDOWN)
,
,;use key for Ctrl/Shift/Alt
,sel(k.vk)
,,case [16,17,18]
,,;out "%i %i" i k.vk
,,;if(up) key- (k.vk); else key+ (k.vk)
,,keybd_event k.vk k.sc k.flags 0
,,;0.1
,
,;out "%i 0x%08X" k.vk lparam
,;out "%i %i" k.vk RealGetKeyState(k.vk)
,PostMessage hwnd m k.vk lparam
,0.01
,
,if(k.vk=VK_MENU) alt=!up