I have a simple SendChar function:
void SendChar(const char mC)
{
INPUT ip={0}; KEYBDINPUT kb={0};
char mK=mC;
kb.wScan=mK;
kb.dwFlags=KEYEVENTF_UNICODE;
ip.type=INPUT_KEYBOARD;
ip.ki=kb;
SendInput(1,&ip,sizeof(INPUT));
}
It run good with normal key but when I want to sends a unicode character example 'á' (0xE1 in unicode table), it sends wrong character ('£').
SendChar(0xE1);
SendChar('á');
But it successes with this
void SendChar()
{
INPUT ip={0}; KEYBDINPUT kb={0};
kb.wScan=0xE1;
kb.dwFlags=KEYEVENTF_UNICODE;
ip.type=INPUT_KEYBOARD;
ip.ki=kb;
SendInput(1,&ip,sizeof(INPUT));
}
Please help me know what wrong with my first function?