4

I am able to inject pointer/touch messages successfully but unable to receive all the messages injected on an application (messages are captured in the application) even though all the messages are injected successfully without any errors. Please do provide any suggestions/solution for the issue.

InitializeTouchInjection(10, TOUCH_FEEDBACK_INDIRECT);

//
// initialize the touch info structure
//
memset(&contact, 0, sizeof(POINTER_TOUCH_INFO));

contact.pointerInfo.pointerType = PT_TOUCH; //we're sending touch input
contact.pointerInfo.pointerId = 0;          //contact 0
contact.pointerInfo.ptPixelLocation.x = 300;
contact.pointerInfo.ptPixelLocation.y = 300;
contact.pointerInfo.pointerFlags = POINTER_FLAG_DOWN | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT;
contact.touchFlags = TOUCH_FLAG_NONE;
contact.touchMask = TOUCH_MASK_CONTACTAREA | TOUCH_MASK_ORIENTATION | TOUCH_MASK_PRESSURE;
contact.orientation = 90;
contact.pressure = 32000;

//
// set the contact area depending on thickness
//
// defining contact area (I have taken area of 4 x 4 pixel)

contact.rcContact.top = contact.pointerInfo.ptPixelLocation.y - 2; 

contact.rcContact.bottom = contact.pointerInfo.ptPixelLocation.y + 2; 

contact.rcContact.left = contact.pointerInfo.ptPixelLocation.x  - 2; 

contact.rcContact.right = contact.pointerInfo.ptPixelLocation.x  + 2;
//
// inject a touch down
//
bRet = InjectTouchInput(1, &contact);

//Setting the Pointer Flag to Drag

contact.pointerInfo.pointerFlags = POINTER_FLAG_UPDATE | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT;
bRet = InjectTouchInput(1, &contact);
for(int i=0;i<100;i++)
{

    contact.pointerInfo.ptPixelLocation.y--; 
    bRet =InjectTouchInput(1, &contact);
}
//
// if touch down was succesfull, send a touch up
//
if (bRet) {
    contact.pointerInfo.pointerFlags = POINTER_FLAG_UP;

    //
    // inject a touch up
    //
    InjectTouchInput(1, &contact);
}
observer
  • 2,925
  • 1
  • 19
  • 38
user970478
  • 41
  • 3

0 Answers0