请教:这样可以实现模拟键盘的control键一直在按下?
比如,让程序模拟键盘的Control键盘一直按着的。这样的话如果我在记事本中键入a时,会发生全选的效果。

解决方案 »

  1.   

    sorry,标题应该为 “怎样”
      

  2.   

    SendInput
    The SendInput function synthesizes keystrokes, mouse motions, and button clicks.UINT SendInput(
      UINT nInputs,     // count of input events
      LPINPUT pInputs,  // array of input events
      int cbSize        // size of structure
    );
      

  3.   

    用keybd_event()函数,举例:keybd_event(VK_CONTROL,0,0,0);
      

  4.   

    再请教:SendInput keybd_event 都没有提到向哪个进程或窗口发送消息啊~
    我的理解是这两个api只对本程序发送键盘或鼠标消息。而我是想要让整个计算机的所有程序都认为,Control键是按下的~~
    这两函数能做到么?
      

  5.   

    这两个API函数对于全局都有效,只要是拥有输入焦点的窗体,就能够接受到。