|
| Author |
Message |
Lorin
Joined: 04 Oct 2007 Posts: 312
|
Posted: Wed Feb 27, 2008 3:47 pm Post subject: Deactivate Form |
|
|
VB6SP6
Non-modal or a modal form that has a timer running to update data in at
richtextbox (launched from the main app form)
This process can be relativly long and causes the whole app to chug.
If the user has it visible then the user will tolerate the chug situation.
If the form is not topmost, then the process should stop updating and
therefore cease the chuging.
How do I determine programmatically when the form is topmost?
Other apps might sit on top of it too. No chuging then either.
tmrUpdate.enabled = Me.Topmost
would be nice.
Archived from group: microsoft>public>vb>general>discussion |
|
| Back to top |
|
 |
Jeff Johnson
Joined: 04 Oct 2007 Posts: 1327
|
Posted: Wed Feb 27, 2008 7:05 pm Post subject: Re: Deactivate Form |
|
|
"Lorin" wrote in message @microsoft.com...
> How do I determine programmatically when the form is topmost?
I think this is what you really want:
http://vbnet.mvps.org/code/subclass/activation.htm |
|
| Back to top |
|
 |
Lorin
Joined: 04 Oct 2007 Posts: 312
|
Posted: Wed Feb 27, 2008 4:28 pm Post subject: Re: Deactivate Form |
|
|
Subclassing freaks me out.
I need real world examples of safe subclassing.
When I have tried it in the past, the IDE would always crash since I was too
wound up in the code work to remember to stop the app properly.
"Jeff Johnson" wrote:
> "Lorin" wrote in message
> @microsoft.com...
>
> > How do I determine programmatically when the form is topmost?
>
> I think this is what you really want:
> http://vbnet.mvps.org/code/subclass/activation.htm
>
>
> |
|
| Back to top |
|
 |
Mike Williams
Joined: 04 Oct 2007 Posts: 1309
|
Posted: Thu Feb 28, 2008 1:01 am Post subject: Re: Deactivate Form |
|
|
"Lorin" wrote in message @microsoft.com...
> Subclassing freaks me out.
It's exciting! Keeps you on your toes! The VB IDE hates it, but compiled
apps love it! Where would we be today if the world explorers of old stayed
safely at home? America would still be in the hands of Gerinomo and his
brood (mind you, perhaps that would be a good thing!) and Captain Morgan
would never have invented his delicious rum! Go for it. Be one of life's
explorers!
> I need real world examples of safe subclassing.
http://www.vbaccelerator.com/home/vb/code/libraries/subclassing/SSubTimer/article.asp
Mike |
|
| Back to top |
|
 |
kpg*
Joined: 04 Oct 2007 Posts: 7
|
Posted: Wed Feb 27, 2008 5:44 pm Post subject: Re: Deactivate Form |
|
|
"Mike Williams" wrote in@TK2MSFTNGP02.phx.gbl:
> "Lorin" wrote in message
> @microsoft.com...
>
>> Subclassing freaks me out.
>
> It's exciting! Keeps you on your toes! The VB IDE hates it, but
> compiled apps love it! Where would we be today if the world explorers
> of old stayed safely at home? America would still be in the hands of
> Gerinomo and his brood (mind you, perhaps that would be a good thing!)
> and Captain Morgan would never have invented his delicious rum! Go for
> it. Be one of life's explorers!
>
>> I need real world examples of safe subclassing.
>
> http://www.vbaccelerator.com/home/vb/code/libraries/subclassing/SSubTim
> er/article.asp
>
> Mike
lol
Took me a while to realize I had to protect blocks of code
that subclassed whatever from the IDE. Setting a global
boolean on startup if in the IDE then testing that before
subclassing - my life has been better since.
kpg |
|
| Back to top |
|
 |
MikeD
Joined: 04 Oct 2007 Posts: 3348
|
Posted: Wed Feb 27, 2008 8:50 pm Post subject: Re: Deactivate Form |
|
|
"Jeff Johnson" wrote in message @corp.supernews.com...
> "Lorin" wrote in message
> @microsoft.com...
>
>> How do I determine programmatically when the form is topmost?
>
> I think this is what you really want:
> http://vbnet.mvps.org/code/subclass/activation.htm
>
Just an idea, but rather than subclassing, could you call
GetForeGroundWindow and compare that to the form's Hwnd property? Of course,
this would need done on a regular basis (such as in a Timer event).
--
Mike
Microsoft MVP Visual Basic |
|
| Back to top |
|
 |
Bob O`Bob
Joined: 04 Oct 2007 Posts: 1456
|
Posted: Wed Feb 27, 2008 6:23 pm Post subject: Re: Deactivate Form |
|
|
Lorin wrote:
> Subclassing freaks me out.
> I need real world examples of safe subclassing.
> When I have tried it in the past, the IDE would always crash since I was too
> wound up in the code work to remember to stop the app properly.
Why bother? Just *know* that it is a possible effect of stopping
subclassed code while in the IDE.
Make sure you really meant "save" or "don't save"
EVERY time you start a run.
So, sometimes you have to restart the IDE. Big Deal.
Computers are supposed to do YOUR bidding, not the other way 'round.
Bob
-- |
|
| Back to top |
|
 |
Larry Serflaten
Joined: 04 Oct 2007 Posts: 2644
|
Posted: Wed Feb 27, 2008 8:55 pm Post subject: Re: Deactivate Form |
|
|
"Bob O`Bob" wrote
> Computers are supposed to do YOUR bidding, not the other way 'round.
Tell that to my local ATM machine!
LFS |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Wed Feb 27, 2008 7:29 pm Post subject: Re: Deactivate Form |
|
|
Lorin wrote:
> Non-modal or a modal form that has a timer running to update data in at
> richtextbox (launched from the main app form)
> This process can be relativly long and causes the whole app to chug.
> If the user has it visible then the user will tolerate the chug situation.
> If the form is not topmost, then the process should stop updating and
> therefore cease the chuging.
> How do I determine programmatically when the form is topmost?
> Other apps might sit on top of it too. No chuging then either.
>
> tmrUpdate.enabled = Me.Topmost
>
> would be nice.
Sounds like Mike's suggestion is best, here. Just slip it into your timer event.
What's taking the time isn't the timer interrupt, but what you're doing within that,
right?
Private Sub tmrUpdate_Timer()
If GetForegroundWindow() = Me.hWnd Then
' real work
End If
End Sub
???
--
..NET: It's About Trust!
http://vfred.mvps.org |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Wed Feb 27, 2008 8:04 pm Post subject: Re: Deactivate Form |
|
|
Karl E. Peterson wrote:
> Lorin wrote:
>> Non-modal or a modal form that has a timer running to update data in at
>> richtextbox (launched from the main app form)
>> This process can be relativly long and causes the whole app to chug.
>> If the user has it visible then the user will tolerate the chug situation.
>> If the form is not topmost, then the process should stop updating and
>> therefore cease the chuging.
>> How do I determine programmatically when the form is topmost?
>> Other apps might sit on top of it too. No chuging then either.
>>
>> tmrUpdate.enabled = Me.Topmost
>>
>> would be nice.
>
> Sounds like Mike's suggestion is best, here. Just slip it into your timer event.
> What's taking the time isn't the timer interrupt, but what you're doing within
> that, right?
>
> Private Sub tmrUpdate_Timer()
> If GetForegroundWindow() = Me.hWnd Then
> ' real work
> End If
> End Sub
>
> ???
PS... But *of course* I heartily agree with those in favor of learning to subclass,
too!
--
..NET: It's About Trust!
http://vfred.mvps.org |
|
| Back to top |
|
 |
MikeD
Joined: 04 Oct 2007 Posts: 3348
|
Posted: Thu Feb 28, 2008 12:59 am Post subject: Re: Deactivate Form |
|
|
"Karl E. Peterson" wrote in message @TK2MSFTNGP04.phx.gbl...
> Karl E. Peterson wrote:
>> Lorin wrote:
>>> Non-modal or a modal form that has a timer running to update data in at
>>> richtextbox (launched from the main app form)
>>> This process can be relativly long and causes the whole app to chug.
>>> If the user has it visible then the user will tolerate the chug
>>> situation.
>>> If the form is not topmost, then the process should stop updating and
>>> therefore cease the chuging.
>>> How do I determine programmatically when the form is topmost?
>>> Other apps might sit on top of it too. No chuging then either.
>>>
>>> tmrUpdate.enabled = Me.Topmost
>>>
>>> would be nice.
>>
>> Sounds like Mike's suggestion is best, here. Just slip it into your
>> timer event.
>> What's taking the time isn't the timer interrupt, but what you're doing
>> within
>> that, right?
>>
>> Private Sub tmrUpdate_Timer()
>> If GetForegroundWindow() = Me.hWnd Then
>> ' real work
>> End If
>> End Sub
>>
>> ???
>
> PS... But *of course* I heartily agree with those in favor of learning to
> subclass, too!
Doesn't sound as if Lorin is one of those people.
--
Mike
Microsoft MVP Visual Basic |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Wed Feb 27, 2008 11:01 pm Post subject: Re: Deactivate Form |
|
|
MikeD wrote:
>> PS... But *of course* I heartily agree with those in favor of learning to
>> subclass, too!
>
> Doesn't sound as if Lorin is one of those people.
Yeah, that's the general picture that's emerging, isn't it?
--
..NET: It's About Trust!
http://vfred.mvps.org
|
|
| Back to top |
|
 |
|