CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2006
    Posts
    47

    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));

  2. #2
    Join Date
    May 2001
    Location
    Oslo, Norway
    Posts
    610

    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

  3. #3
    Join Date
    Apr 2006
    Posts
    47

    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
    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?

  4. #4
    Join Date
    Dec 2001
    Posts
    6,332

    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?
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  5. #5
    Join Date
    Feb 2002
    Posts
    4,640

    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

  6. #6
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured