protecting you window from IM windows and other dangers :P
Hey everyone:
I want the user to choose when they close down my application, so I listen for user input... but these pesky IM windows always interrupt my app and steal focus. I've tried not responding to the following messages.... then I tried what you'll see below.
I thought by handling them I'd be OK... but IM windows (from Gaim for instance) totally kills focus of my program. Thoughts? Thanks!
case WM_KILLFOCUS:
case WM_QUIT:
case WM_CLOSE:
case WM_DESTROY:
return(DefWindowProc(hWnd, message, wParam, lParam));
Re: protecting you window from IM windows and other dangers :P
Can you plz explain what you mean by "i want the user to choose when they close down my application..."? Anyone can close your app any time by clicking the 'X' button, no? No need to bother with anything... I know i am missing something here :p
Re: protecting you window from IM windows and other dangers :P
Quote:
Originally Posted by Amn
Can you plz explain what you mean by "i want the user to choose when they close down my application..."? Anyone can close your app any time by clicking the 'X' button, no? No need to bother with anything... I know i am missing something here :p
Sure, please let me explain myself a little better.
I have distinct ways that the user can shut down my application. They know how to do it. What I don't want to happen is for another application to cause mine to lose focus, or to shut it down. I'm writing a screensaver and when anything like an IM window pops up, it ends the screensaver. I'd rather terminate on user input (mouse moves, keystrokes, mouse buttons, etc...) and not simply other app's messages. I'm writing for NT based machines (XP, 2000, etc...).
Does this make sense?
Re: protecting you window from IM windows and other dangers :P
I would think it could be easily done by watching the position of the mouse for changes, and the keyboard, not messages sent to the window. Isn't that how screensavers are normally?
Re: protecting you window from IM windows and other dangers :P
Quote:
Originally Posted by WizBang
I would think it could be easily done by watching the position of the mouse for changes, and the keyboard, not messages sent to the window. Isn't that how screensavers are normally?
That's what I thought... When my screensaver is running, IM windows do not cause it to terminate (kinda defeats the purpose).
Viggy
Re: protecting you window from IM windows and other dangers :P
Possibly the IM window does some mouse move/keyboard simulation using SendInput or other API.