Click to See Complete Forum and Search --> : Prevent user from switching to another application
VCDev
May 2nd, 2003, 07:00 AM
I don't want the user to activate another application window. As soon as the user selects another application window, the focus should come back to my application window. In other words, my application's window should always be the active/foreground window. Even if another application is started, my application's window should remain the active one.
If you have answer to it please email me at snorders@lycos.com or post your reply here.
the_ENIGMA
May 2nd, 2003, 07:17 AM
if you want you window to remain always on Top,
use this style in CreateWindowEx -- WS_EX_TOPMOST
if you want to auto-reactivate your window, when
use selects some other application window,
in that case handle this WM_NCACTIVATE
in your wnd Proc, and write a code to
activate your window...
combine both, and the other user won't
be able to save his *** away from your window..
untill he kills it...
rxbagain
May 3rd, 2003, 01:04 AM
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NORESIZE);
Hope this will help you
mahanare
May 3rd, 2003, 02:44 AM
Originally posted by the_ENIGMA
if you want you window to remain always on Top,
use this style in CreateWindowEx -- WS_EX_TOPMOST
if you want to auto-reactivate your window, when
use selects some other application window,
in that case handle this WM_NCACTIVATE
in your wnd Proc, and write a code to
activate your window...
combine both, and the other user won't
be able to save his *** away from your window..
untill he kills it...
I didn't try but Enigma's solution is interesting.
without much problem we can hurt the user with our application
cheers
mahanare
VCDev
May 5th, 2003, 01:18 AM
I have used the WS_EX_TOPMOST and WM_NCACTIVATE. Used SetForegroundWindow and SetFocus under WM_NCACTIVATE to set the focus back to my window. This combination has made by window to stay, always on top. But, though my window is always on the top and is having the focus, its not preventing the keyboard focus from being shifted to another application. If another application gets activated, it gets the keyboard focus (and the window focus also along with my window), though my window is the topmost and with the focus. So, whatever key I hit, gets directed to the other application.
Originally posted by the_ENIGMA
if you want you window to remain always on Top,
use this style in CreateWindowEx -- WS_EX_TOPMOST
if you want to auto-reactivate your window, when
use selects some other application window,
in that case handle this WM_NCACTIVATE
in your wnd Proc, and write a code to
activate your window...
combine both, and the other user won't
be able to save his *** away from your window..
untill he kills it...
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.