Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » keeping the window focus

This thread is locked; no one can reply to it. rss feed Print
keeping the window focus
KaBlammyman
Member #455
June 2000
avatar

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.

->Insert clever quote here<-
http:my website

A J
Member #3,025
December 2002
avatar

then the program is broken.

___________________________
The more you talk, the more AJ is right. - ML

KaBlammyman
Member #455
June 2000
avatar

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.

->Insert clever quote here<-
http:my website

adamk kromm
Member #5,432
January 2005

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

----------
-Adam Kromm

My Website

A J
Member #3,025
December 2002
avatar

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 ?

___________________________
The more you talk, the more AJ is right. - ML

KaBlammyman
Member #455
June 2000
avatar

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.

->Insert clever quote here<-
http:my website

Synapse Jumps
Member #3,073
December 2002

Did you try set_switch_display_mode?

A J
Member #3,025
December 2002
avatar

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

___________________________
The more you talk, the more AJ is right. - ML

CGamesPlay
Member #2,559
July 2002
avatar

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.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

KaBlammyman
Member #455
June 2000
avatar

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.

->Insert clever quote here<-
http:my website

Go to: