SendInput vs. keybd_event

前端 未结 2 1973
野的像风
野的像风 2021-01-19 04:45

MSDN states that keybd_event has been superceded by SendInput. During a rewrite I switched to using SendInput...which was fine except when trying to send an

2条回答
  •  执笔经年
    2021-01-19 05:30

    this way you can use the keybd_event:

    keybd_event( VK_MENU, MapVirtualkey( VK_MENU, 0 ), KEYEVENTF_EXTENDEDKEY or 0, 0);
      keybd_event( Ord('M'), MapVirtualKey( Ord('M'),0), KEYEVENTF_EXTENDEDKEY or 0, 0);
      keybd_event( Ord('M'), MapVirtualKey( Ord('M'),0), KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
      keybd_event( VK_MENU, MapVirtualkey( VK_MENU, 0 ), KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
    

提交回复
热议问题