PostMessage on JUCE window


#1

Hi all,

I’m trying to control a juce window by using the PostMessage() API of Windows. I did Spy++ on a window to see what messages are generated and I’m posting those to simulate a drag and drop movement but the window doesn’t respond to it. I’m wondering if JUCE queries the cursor position or simply works on Windows messages and that I’m missing something here.

Thanks


#2

It’ll respond to messages same as any other win32 window… But drag and drop is quite complicate, involving COM objects and stuff, so probably a bit of a pain to try to emulate it via PostMessage(). What are you actually trying to do?


#3

I’m trying to have onMouseDown() to be called on a juce EventListener when I do PostMessage() with WM_LBUTTONDOWN but it doesn’t get called. I’m trying to figure out what makes juce call that function.


#4

Yes, but what are you actually trying to achieve? Why do you want to trigger this event? Simulating mouse-clicks is probably the worst possible way to communicate between processes.


#5

We have a tool for visualization with an OpenGL window inside. We’re working on integrating closed-source applications and are in need of syncing three instances of this tool with the user input. Simply, when the user is controlling one view (panning, zooming, rotating etc.) we want other two be responding to this as well, doing the same interactions. To give more of a context, we have them one on top and are building a mask in one of the viewers and using it to combine the other two, making the parts with the mask transparent.

I hope this gives you some context for what I’m trying to achieve.


#6

Wow, sounds like a tricky task! Have you tried using an event viewer to spy on the events caused by a real click, so that you can make sure you’re copying them correctly?


#7

I did. That’s why I was wondering if there are other things that involve a click response to be generated, like whether JUCE queries the actual mouse position to figure out if its really in the window etc. I had it not working for a lot of other applications too, so its not a surprise that it doesn’t work in this case but I’m trying to generalize it to whether there is something common that is done in the applications where postmessage() doesn’t work.


#8

I haven’t tried this tool, but it’s description made it sound like it might be helpful to you…

http://www.codeproject.com/KB/winsdk/messagespy.aspx


#9

That’s quite possible, it does check the mouse position in a few places. It might also be checking whether its process is actually the foreground process too, and there’s also the idea of mouse-capture - if another window has the mouse-capture, then it won’t be able to get any drag events. It’s all a bit of a minefield, I’m afraid!