模拟键盘消息

// 输入中文
void InputCH(HWND hWnd, CString cstrInput)
{
    DWORD word = 0;
    for (int i=0; i < cstrInput.GetLength(); i+=2)
    {
        memcpy(&word, &cstrInput.GetBuffer(NULL)[i], 2);
        SendMessage(hWnd, WM_CHAR, word, 0);
        Sleep(10);
    }
}

posted on 2015-08-08 17:16  伊扎洛  阅读(90)  评论(0)    收藏  举报

导航