469,304 Members | 2,018 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,304 developers. It's quick & easy.

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 8514
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Susan Bricker | last post: by
5 posts views Thread by [Yosi] | last post: by
6 posts views Thread by scottyman | last post: by
reply views Thread by Udi | last post: by
4 posts views Thread by easoftware | last post: by
reply views Thread by ofzer | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.