Inserting fake mouse event into the message queue?

  • Thread starter Thread starter Johnny J.
  • Start date Start date
J

Johnny J.

This is the situation: I'm developing an add-in for Visual Studio where I
need to trap doubleclick events in the active document.

I've got a local mouse hook installed and that works perfectly. I catch the
doubleclick event and check the VS activedocument properties.

BUT: If I've got more than one tab group (vertical or horizontal), this
scenario can arise: The active document is e.g. Form1.cs in one of the tab
groups. I then doubleclick Form2.cs which is in another tab group. The
doubleclick event will be caught by the mouse hook, but the VS
activedocument will not have changed yet. It will still be Form1.cs.

I don't really know what the best procedure would be to force the
activedocument change before the doubleclick event is triggered, but my idea
was that I might be able to send a mouseclick event to the same queue the
doubleclick event came from BEFORE checking the activedocument property. I
don't know if that would work and actually activate the right document, but
I can't think of any other solution... I don't know how to accomplish it,
though. Can anybody give me an idea...???

I MIGHT be able to check the window under the mousepointer when the
doubleclick is fired, but I think that might be more complicated than the
above approach.

Any idea is welcome,
Johnny J.
 
I don't really know what the best procedure would be to force the
activedocument change before the doubleclick event is triggered, but my
idea was that I might be able to send a mouseclick event to the same queue
the doubleclick event came from BEFORE checking the activedocument
property. I don't know if that would work and actually activate the right
document, but I can't think of any other solution... I don't know how to
accomplish it, though. Can anybody give me an idea...???

That's unlikely to work (I not a C# guru myself). In fact it's likely to
simply retrigger your hooked event again - effectively creating a perpetual
loop!

Regards,
Nicolas
 
It shouldn't - I only trap doubleclick events, so a single click event
should pass right through...

/Johnny
 
Back
Top