mouseevent - How Do I Use SendInput in Delphi? -


i using mouse_event function in delphi 2009, delphi documentation says function has been superceded , use sendinput instead.

the delphi sendinput documentation defines syntax , parameters, there no examples , not clear how use function. i've looked around on web, , can't find delphi examples.

specifically, trying simulate left mouse down , up. mouse_event follows:

    mouse_event(mouseeventf_absolute or mouseeventf_leftdown, 0, 0, 0, 0);     mouse_event(mouseeventf_absolute or mouseeventf_leftup, 0, 0, 0, 0); 

how using sendinput?


followup:

i ended leaving code as @david suggested.

but gave @opc0de answer since did give answer question. however, can't vouch correct, because never did try it.

here how simulate left click more details visit http://msdn.microsoft.com/en-us/library/ms646310(vs.85).aspx

var eu: array [0..1] of tinput; begin   zeromemory(@eu,sizeof(eu));   eu[0].itype := input_mouse;   eu[0].mi.dwflags :=mouseeventf_leftdown;   eu[1].itype := input_mouse;   eu[1].mi.dwflags :=mouseeventf_leftup;   sendinput(2,eu[0],sizeof(tinput)); end; 

and here simulating right click

var eu: array [0..1] of tinput; begin   zeromemory(@eu,sizeof(eu));   eu[0].itype := input_mouse;   eu[0].mi.dwflags :=mouseeventf_rightdown;   eu[1].itype := input_mouse;   eu[1].mi.dwflags :=mouseeventf_rightup;   sendinput(2,eu[0],sizeof(tinput)); end; 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -