Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Win32 (http://www.go4expert.com/forums/win32/)
-   -   Mimicing L Mouse Button Click on 3rd Party App (http://www.go4expert.com/forums/mimicing-l-mouse-button-click-3rd-party-t14757/)

woodced 24Oct2008 14:12

Mimicing L Mouse Button Click on 3rd Party App
 
Hi all,



I'm a video editor and my software of choice is Avid Media Composer. I was recently moved to try to add some personal enhancements to Avid's keymapping system which in places is somewhat wanting. Media Composer has a Window called Audio Mixer in which there are a series of buttons (though not windows buttons). I'm using Windows Hooks to try to intercept a keypress and spoof a keypress on the buttons in the Audio Mixer window.

My thought was to use the Win32 SendMessage function to send an WM_LBUTTONDOWN and WM_LBUTTONUP with the appropriate x and y positions in the Audio Mixer window. Using a similar method I can, for instance, fake a press of the Windows Start button. However, this method doesn't seem to work with the Audio Mixer window. I get no response at all from the UI. [as an aside when I do it with the Start button watching the Start button messages with Spy++ I cannot see the WM_LBUTTONDOWN message I send to the button. Is this normal? Why is it?]

Being an editor, I'm not the greatest programmer in the world, so am not completely au fait with win32 calls. I've tried using both SendMessage and PostMessage and neither seem to be doing anything. Without being able to see the messages in Spy++ or any UI feedback it's not clear what is going on, or indeed what to try next. Can anyone give me some pointers? By the way I'm hooking the WH_MOUSE_LL hook.

Steve

shabbir 24Oct2008 14:29

Re: Mimicing L Mouse Button Click on 3rd Party App
 
No you should see the same message when using the mouse and when sending using external application.

Did you get the handle and other stuff correctly

xpi0t0s 26Oct2008 01:47

Re: Mimicing L Mouse Button Click on 3rd Party App
 
It depends how the application reads the mouse. Some use the WM_LBUTTONDOWN and UP messages; others just have a look at the state of the keys, for example GetAsyncKeyState(VK_LBUTTON) will tell you if the left button is up or down.

SendMessage and PostMessage do the same thing, but differ in when the message is sent. SendMessage sends it NOW and returns control to you when the message has been sent. PostMessage just sticks the message on the queue to be handled whenever it gets round to it. So if SendMessage(WM_LBUTTONDOWN) doesn't do it, neither will PostMessage(WM_LBUTTONDOWN).


All times are GMT +5.5. The time now is 17:01.