By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

How to prevent program losing focus?

P: n/a
I'm pretty sure this has been mentioned a few times, but so far I haven't
found anything.

I am trying to "lock" a program to always focus, non closable etc, but
overriding OnDeactivate and calling Activate() only works 1 time, and
never again. After the initial refocus it never seems to fire. What else
needs to be done?

Is it possible to just cancel a deactivation completely?

--
The hotmail account will most likely not be read, so please respond only
to the news group.
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Morten,
Well, to start with, it's better to use web form in that case. You will need
to customize your control, through html editing. Normally, there are no drop
down lists available when editing your control, but you can use "Item
Template" to create a control similar to the combo box. As for the test box,
there is this option when editing html to create your control.
--
Rami Saad
Microsoft GTSC Developer support for Middle East
"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:op**************@msnews.microsoft.com...
I'm pretty sure this has been mentioned a few times, but so far I haven't
found anything.

I am trying to "lock" a program to always focus, non closable etc, but
overriding OnDeactivate and calling Activate() only works 1 time, and
never again. After the initial refocus it never seems to fire. What else
needs to be done?

Is it possible to just cancel a deactivation completely?

--
The hotmail account will most likely not be read, so please respond only
to the news group.

Nov 15 '05 #2

P: n/a
You can handle the "Validating" event. Set the control's property of "Causes
validation" to true, as well as the control that follows. And repeat that
for every other control. And, on the Validating eventhandler, set the
CancelEventArgs.Cancel=True;

This will keep the control focused, disallowing that you lose focus. You can
do the same thing to the whole form, or any button on it.
--
Rami Saad
Microsoft GTSC Developer support for Middle East
"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:op**************@msnews.microsoft.com...
I'm pretty sure this has been mentioned a few times, but so far I haven't
found anything.

I am trying to "lock" a program to always focus, non closable etc, but
overriding OnDeactivate and calling Activate() only works 1 time, and
never again. After the initial refocus it never seems to fire. What else
needs to be done?

Is it possible to just cancel a deactivation completely?

--
The hotmail account will most likely not be read, so please respond only
to the news group.

Nov 15 '05 #3

P: n/a
I'm afraid web would not be an option as I am going to use some intricate
userinteracted controls which I'm not sure would work in a web page.

As for the validating, it still allows other programs to get focus
(ALT-TAB) :(
--
The hotmail account will most likely not be read, so please respond only
to the news group.
Nov 15 '05 #4

P: n/a
You may want to read this which specifically states "Don't try, We at
microsoft made it hard to impossible on purpose".

http://weblogs.asp.net/oldnewthing/a.../16/73780.aspx

"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:op**************@msnews.microsoft.com...
I'm pretty sure this has been mentioned a few times, but so far I haven't
found anything.

I am trying to "lock" a program to always focus, non closable etc, but
overriding OnDeactivate and calling Activate() only works 1 time, and
never again. After the initial refocus it never seems to fire. What else
needs to be done?

Is it possible to just cancel a deactivation completely?

--
The hotmail account will most likely not be read, so please respond only
to the news group.

Nov 15 '05 #5

P: n/a
Except there are cases when the user for good reasons should not have
control of the application. Not to mention that there are several such
programs around already.

--
The hotmail account will most likely not be read, so please respond only
to the news group.
Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.