473,387 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Make form deactivate itself?

Is it possible to make a form deactivate itself without minimizing it?

I have written a small utility which copies selected files from CDs
(hundreds of them). I put a CD in the tray and click a button on the form to
tell it the next CD is ready for it to process. Each CD takes a few minutes
to copy, and the form has a textbox at which I glance to see the progress. I
have the form sending itself to the back, but it would be nice if it would
also relinquish focus to the previously active window.

..NET 1.1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form.ActiveForm.SendToBack()
Form.ActiveForm.Deactivate() ' no such method :-(
' process CD

Only a few hundred more CDs to do...

Andrew
Mar 8 '07 #1
5 9169
Andrew Morton schreef:
Is it possible to make a form deactivate itself without minimizing it?

I have written a small utility which copies selected files from CDs
(hundreds of them). I put a CD in the tray and click a button on the form to
tell it the next CD is ready for it to process. Each CD takes a few minutes
to copy, and the form has a textbox at which I glance to see the progress. I
have the form sending itself to the back, but it would be nice if it would
also relinquish focus to the previously active window.

.NET 1.1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form.ActiveForm.SendToBack()
Form.ActiveForm.Deactivate() ' no such method :-(
' process CD

Only a few hundred more CDs to do...

Andrew

form.enabled=false
--
Rinze van Huizen
C-Services Holland b.v
Mar 8 '07 #2
C-Services Holland b.v. wrote:
Andrew Morton schreef:
>Is it possible to make a form deactivate itself without minimizing
it? I have written a small utility which copies selected files from CDs
(hundreds of them). I put a CD in the tray and click a button on the
form to tell it the next CD is ready for it to process. Each CD
takes a few minutes to copy, and the form has a textbox at which I
glance to see the progress. I have the form sending itself to the
back, but it would be nice if it would also relinquish focus to the
previously active window. .NET 1.1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form.ActiveForm.SendToBack()
Form.ActiveForm.Deactivate() ' no such method :-(
' process CD

Only a few hundred more CDs to do...

form.enabled=false
No, that doesn't work, it just disables the form while leaving it as the
active window and the only way to close it then is through the Task Manager
:-(

Andrew
Mar 8 '07 #3
Andrew Morton schreef:
>form.enabled=false

No, that doesn't work, it just disables the form while leaving it as the
active window and the only way to close it then is through the Task Manager
:-(

Andrew

Well, how is the form displayed? If it's by using .showdialog(), then
what you want is not possible because that dialog is then modal.

--
Rinze van Huizen
C-Services Holland b.v
Mar 9 '07 #4
C-Services Holland b.v. wrote:
Andrew Morton schreef:
C-Services Holland b.v. wrote:
>>form.enabled=false

No, that doesn't work, it just disables the form while leaving it as
the active window and the only way to close it then is through the
Task Manager :-(

Well, how is the form displayed? If it's by using .showdialog(), then
what you want is not possible because that dialog is then modal.
It's a simple Windows application. I couldn't find anything in the Windows
API docs on the MSDN website - although that doesn't mean there isn't
anything. Maybe there's a more relevant newsgroup for me to ask in?

I've done a couple of screen-grabs of what to show what does and what I'd
like to happen:
http://www.in-press.co.uk/windowsamp...dowsample.html (22KB)

There's only about 100 CDs left to do now, so there's no need for a solution
any more.

Andrew
Mar 12 '07 #5
Andrew Morton wrote:
It's a simple Windows application. I couldn't find anything in the
Windows API docs on the MSDN website - although that doesn't mean
there isn't anything.
For the benefit of anyone reading this in the future...

As I reach the end of the task, I found the GetWindow function in
user32.dll, with which I could have retrieved the window handle to the next
window in z-order (i.e. the previously activate one) so, with the handle, I
would have been able to activate that window.

Andrew
Mar 12 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Seth Russell | last post by:
I'm running Kevin Roth's rte box and i want to deactivate the ability to past inside the box. People sometimes paste outrageous things in there that might break my site. How can I deactivate the...
9
by: Susan Bricker | last post by:
I am currently using the OnDirty event of a Form to detect whether any fields have been modified. I set a boolean variable. Then, if the Close button is clicked before the Save button, I can put...
5
by: [Yosi] | last post by:
Why I can't catch the Form lost focuse event ? I mad a FORM , I want to print message each time I moved to another application my my desktop . I thryed the following but not work . ...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
0
by: Udi | last post by:
Hi, MDIChild pops up a listbox on a certain event. The problem is that the location of the listbox can go out of the MDIChild bounds. When this happens, I see only a part of the listbox. 1. Is...
4
by: easoftware | last post by:
I am using VS .Net 2003 and VB. I have an app with one parent and two Mdi child forms. I need to validate data in the Mdi form. The Form.Validating event works when I try to close a Mdi form,...
0
by: ofzer | last post by:
Hi .. I wrote a windows application in perl/tk. I would like to deactivate parent windows when I open new one. for example : lets say I am in the main window now and I press on the...
0
by: Arif Khan | last post by:
I am getting folllowing error in one of the service components. I have not override base class's (ServicedComponent ) Deactivate function. Also it's library component called by asp.net worker...
7
subashini Thiyagarajan
by: subashini Thiyagarajan | last post by:
Hi , In ASP how to deactivate few fields while inserting a record to the database(access). i want to insert a record.e.g having 5 fields.it is not reqired to fill all the fields in a form as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.