keeping the window focus
KaBlammyman

Hello,

I have yet another win32 question (this isn't allegro related, but i guess it could be)
Anyway, I have a program that uses windows hooks to catch mouse events, and sends them over a socket connection. When it runs, it runs without a window, therefore, you cant switch focus to it. Because it cant get focus, the program only sends the data when mouse movements/clicks happen on the desktop. How can I make it so that no matter what, it will send all mouse movements?

thanx.

P.S. I know that all events are being captured because a log file the program creates while it runs confirms this. Its just that the data isnt being transmitted over the network.

A J

then the program is broken.

KaBlammyman

uummm no.::)

I works fine when th window has focus. How do I know? Because I can have it start with or without a window via a text file. When the visible window has focus, it works fine. Maybe it doesn't need a visible window or window focus to work, but that was what I am guessing since it works fine when the window is visible and does have focus.

I just need it to do what it has to do, even when other programs have the window focus.

adamk kromm

i dont know if this will work but it might.

 set_display_switch_mode(SWITCH_BACKGROUND);

what this does is stops your program from "pausing" when its not the active window...

EDIT: here is the page describing it http://www.allegro.cc/manual/api/graphics-modes/set_display_switch_mode

A J

Sounds like it needs a window to capture mouse events.
Therefore it does not perform the task you want, so either its not suitable, or if you claim its supposed to be, then its broken.

Have you read all the requirements of the window hooks functions on MSDN ?

KaBlammyman

The hook part works fine (my log file shows e that everything is cought)...its the auctual sending of data that doesnt work without widnow focus.

Synapse Jumps

Did you try set_switch_display_mode?

A J

that doesn't make any sense, sending network data has absolutely zero to do with windows/focus.

CGamesPlay

The only things set_display_switch_mode affects (aside from possibly some graphics driver adjustments) are timer interrupts: Allegro doesn't send them when the window doesn't have focus. Other timing methods work normally.

KaBlammyman
Quote:

that doesn't make any sense, sending network data has absolutely zero to do with windows/focus.

thats what I thought...but unless the window has focus, the data wont be sent. I telnet'ed (since the final product will communicate with telnet) to myself, so thats how i can tell if the data is being sent or not.

update if the mouse is over the window, it will send data...even if it isn't the top window/focused window.

Thread #585575. Printed from Allegro.cc