473,464 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to prevent program losing focus?

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
5 4994
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DomGo | last post by:
Hi, I try to open a form, that automatically loses focus to the window, that had the focus immediatly before the new form has been opened. The new form is topmost and displays a message only for...
0
by: Stefan De Schepper | last post by:
Dear NG, I created a gridlike usercontrol. When clicking on a cell a textbox (or other control, depending on the cell's editortype) is shown. When some other control gets the focus, the textbox...
3
by: Chris | last post by:
I have a form that calls ShowDialog on a number of different forms at different times. I want to be able to know anytime the form loses focus. But Form.Focused isn't ever true once a control has...
14
by: Ed Jay | last post by:
On a multi-textbox form, linked to an external js, I use onBlur to call: function chkNum(cellname) { var str = document.getElementById(cellname).value.toString(10); if (str < 28 || str > 36)...
1
by: Stefan Mueller | last post by:
In my example the focus should only jump to textbox2 if you press the tab key and if '11' is in textbox1. That works fine. However if you enter e.g. '12' in textbox1 and click on 'Link', Mozilla...
11
by: RobKinney1 | last post by:
Hello, I am looking for a clever way to prevent someone from pasting copied text outside of my app. I know how to monitor the clipboard and get an WM_DRAWCLIPBOARD message when text is stored...
5
by: freelancex | last post by:
Hi, Im new to this forum, and new to scripting in general. Im an ICT Technician for a high school and i am designing a Form in visual basic 2005. The intended purpose of the Form, is to prevent...
5
by: LabGeek | last post by:
I have an Access application that I have created that collects data from a scanner and from a weighting scale. The data from the scanner are unique identifiers (barcodes) and the scanner is...
25
bugboy
by: bugboy | last post by:
I'm trying to find a cross browser solution for editing text in a flickr photo caption manor where the text is displayed in a <div> or <a> tag but changes to a <textarea> via JS when clicked. ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.