Skip to content

Instantly share code, notes, and snippets.

@float-tw
Created December 14, 2011 18:35
Show Gist options
  • Save float-tw/1477860 to your computer and use it in GitHub Desktop.
Save float-tw/1477860 to your computer and use it in GitHub Desktop.
用p代替滑鼠左鍵(windows)
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
int chk;
while(1)
{
Sleep(1);
chk = GetKeyState('P');
if(chk&0x80)
{
chk = GetKeyState(VK_LBUTTON);
if( (chk&0x80) == 0)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
}
else
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment