473,326 Members | 2,680 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,326 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 9155
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.