Home All Groups Group Topic Archive Search About

Closing Grouped instances in the taskbar

Author
1 Sep 2010 5:51 PM
Sneha Menon
Hi All

VB6 Application. If there are a number of instances of the application
running, and they are grouped in the taskbar, how can I close all
instances by clicking 'Close Group' ? What shall I do in my vb6
application to make it respond to the windows 'Close Group' ? (OS is
windows XP)

Thanks.

Sneha

Author
1 Sep 2010 6:50 PM
ralph
On Wed, 1 Sep 2010 10:51:59 -0700 (PDT), Sneha Menon
<spiderang***@gmail.com> wrote:

>Hi All
>
>VB6 Application. If there are a number of instances of the application
>running, and they are grouped in the taskbar, how can I close all
>instances by clicking 'Close Group' ? What shall I do in my vb6
>application to make it respond to the windows 'Close Group' ? (OS is
>windows XP)
>

Have you defined a QueryUnload Event?

Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
    On Error Resume Next
    'UnloadMode possibilities:
    '0   The user has chosen the Close command from the Control-menu
box on the form.
    '1   The Unload method has been invoked from code.
    '2   The current Windows-environment session is ending.
    '3   The Microsoft Windows Task Manager is closing the
application.
    '4   An MDI child form is closing because the MDI form is closing.

    ' insert what ever you want to check here
    ' for example, if unsaved data
    If globalDirtyFlag Then
    Cancel = True
    End If
    ' or most often used to catch the 'close command'
    If UnloadMode <> 1 Then
    Cancel = True
    ' free to continue with program
    End If
End Sub
Author
1 Sep 2010 9:17 PM
Karl E. Peterson
Sneha Menon formulated on Wednesday :
> VB6 Application. If there are a number of instances of the application
> running, and they are grouped in the taskbar, how can I close all
> instances by clicking 'Close Group' ? What shall I do in my vb6
> application to make it respond to the windows 'Close Group' ? (OS is
> windows XP)

Almost certainly, nothing.  Windows will just attempt to "close
nicely", presumably by sending WM_CLOSE to the top-level window, all
apps in that group.

Yep, just tested in both Win7x64 and XP.  You treat "Close Group"
absolutely no differently than you do "Close".

--
..NET: It's About Trust!
http://vfred.mvps.org
Author
1 Sep 2010 10:46 PM
ralph
On Wed, 01 Sep 2010 14:17:37 -0700, Karl E. Peterson <k***@exmvps.org>
wrote:

>Sneha Menon formulated on Wednesday :
>> VB6 Application. If there are a number of instances of the application
>> running, and they are grouped in the taskbar, how can I close all
>> instances by clicking 'Close Group' ? What shall I do in my vb6
>> application to make it respond to the windows 'Close Group' ? (OS is
>> windows XP)
>
>Almost certainly, nothing.  Windows will just attempt to "close
>nicely", presumably by sending WM_CLOSE to the top-level window, all
>apps in that group.
>
>Yep, just tested in both Win7x64 and XP.  You treat "Close Group"
>absolutely no differently than you do "Close".

That's why I suggested the QueryUnload ... my guess is the OP is
capturing the WM_CLOSE somewhere.

I've done that before. Get so involved in making sure a user has only
"one way out" or keeping a resource alive, I forget there may be times
you want to let the O/S close it. <g>

-ralph
Author
1 Sep 2010 11:01 PM
Karl E. Peterson
ralph explained on 9/1/2010 :
Show quoteHide quote
> On Wed, 01 Sep 2010 14:17:37 -0700, Karl E. Peterson <k***@exmvps.org>
> wrote:
>
>> Sneha Menon formulated on Wednesday :
>>> VB6 Application. If there are a number of instances of the application
>>> running, and they are grouped in the taskbar, how can I close all
>>> instances by clicking 'Close Group' ? What shall I do in my vb6
>>> application to make it respond to the windows 'Close Group' ? (OS is
>>> windows XP)
>>
>> Almost certainly, nothing.  Windows will just attempt to "close
>> nicely", presumably by sending WM_CLOSE to the top-level window, all
>> apps in that group.
>>
>> Yep, just tested in both Win7x64 and XP.  You treat "Close Group"
>> absolutely no differently than you do "Close".
>
> That's why I suggested the QueryUnload ... my guess is the OP is
> capturing the WM_CLOSE somewhere.

Yeah, I'd hoped to imply that with the last sentence.

> I've done that before. Get so involved in making sure a user has only
> "one way out" or keeping a resource alive, I forget there may be times
> you want to let the O/S close it. <g>

Oops. <g>

--
..NET: It's About Trust!
http://vfred.mvps.org
Author
2 Sep 2010 12:07 AM
Sneha Menon
> Almost certainly, nothing.  Windows will just attempt to "close
> nicely", presumably by sending WM_CLOSE to the top-level window, all
> apps in that group.

That's what I had thought. And, as almost all the projects I had
handled was single instance ones I hadn't done any research into it.

But One of my applications(a custom browser, Multiple instances of
it), it is not responding to 'Close Group' calls. Nothing happens when
I click 'Close Group'

The application does not have a mdi form.
The Main form does not have a conventional title bar. An activeX
component (w/ icon, caption, min button, close button, customizable
gradient BG) serve as the title bar.
No any code in QueryUnload event.

What could be the possible reasons? Ralph was mentioning queryunload,
but I could not see anything in the post addressing the 'close group'
issue. Is there anything I can do in the QueryUnload to make the
application close all its instances?

Sneha
Author
2 Sep 2010 1:05 AM
Karl E. Peterson
Sneha Menon pretended :
Show quoteHide quote
>> Almost certainly, nothing.  Windows will just attempt to "close
>> nicely", presumably by sending WM_CLOSE to the top-level window, all
>> apps in that group.
>
> That's what I had thought. And, as almost all the projects I had
> handled was single instance ones I hadn't done any research into it.
>
> But One of my applications(a custom browser, Multiple instances of
> it), it is not responding to 'Close Group' calls. Nothing happens when
> I click 'Close Group'
>
> The application does not have a mdi form.
> The Main form does not have a conventional title bar. An activeX
> component (w/ icon, caption, min button, close button, customizable
> gradient BG) serve as the title bar.
> No any code in QueryUnload event.
>
> What could be the possible reasons? Ralph was mentioning queryunload,
> but I could not see anything in the post addressing the 'close group'
> issue. Is there anything I can do in the QueryUnload to make the
> application close all its instances?

Well, you could certianly try it, but given you don't have a standard
titlebar I'm starting to suspect that your app isn't processing
WM_CLOSE at all.  What happens when you have a single instance, and
just select "Close" from the right-click on the taskbar menu?

Since you've chosen to use a non-standard UI, odds are you're going to
need to do some message sniffing with Spy++ and probably subclass the
hidden top-level window watching for WM_CLOSE.  But your use of the 3rd
party tool really means only you can troubleshoot this one.

--
..NET: It's About Trust!
http://vfred.mvps.org
Author
2 Sep 2010 3:17 AM
ralph
On Wed, 01 Sep 2010 18:05:27 -0700, Karl E. Peterson <k***@exmvps.org>
wrote:

Show quoteHide quote
>Sneha Menon pretended :
>>> Almost certainly, nothing.  Windows will just attempt to "close
>>> nicely", presumably by sending WM_CLOSE to the top-level window, all
>>> apps in that group.
>>
>> That's what I had thought. And, as almost all the projects I had
>> handled was single instance ones I hadn't done any research into it.
>>
>> But One of my applications(a custom browser, Multiple instances of
>> it), it is not responding to 'Close Group' calls. Nothing happens when
>> I click 'Close Group'
>>
>> The application does not have a mdi form.
>> The Main form does not have a conventional title bar. An activeX
>> component (w/ icon, caption, min button, close button, customizable
>> gradient BG) serve as the title bar.
>> No any code in QueryUnload event.
>>
>> What could be the possible reasons? Ralph was mentioning queryunload,
>> but I could not see anything in the post addressing the 'close group'
>> issue. Is there anything I can do in the QueryUnload to make the
>> application close all its instances?
>
>Well, you could certianly try it, but given you don't have a standard
>titlebar I'm starting to suspect that your app isn't processing
>WM_CLOSE at all.  What happens when you have a single instance, and
>just select "Close" from the right-click on the taskbar menu?
>
>Since you've chosen to use a non-standard UI, odds are you're going to
>need to do some message sniffing with Spy++ and probably subclass the
>hidden top-level window watching for WM_CLOSE.  But your use of the 3rd
>party tool really means only you can troubleshoot this one.

Why is all the really interesting information always so late in
coming?

-ralph
<g>
Author
2 Sep 2010 5:38 PM
Karl E. Peterson
After serious thinking ralph wrote :
Show quoteHide quote
> On Wed, 01 Sep 2010 18:05:27 -0700, Karl E. Peterson <k***@exmvps.org>
> wrote:
>
>> Sneha Menon pretended :
>>>> Almost certainly, nothing.  Windows will just attempt to "close
>>>> nicely", presumably by sending WM_CLOSE to the top-level window, all
>>>> apps in that group.
>>>
>>> That's what I had thought. And, as almost all the projects I had
>>> handled was single instance ones I hadn't done any research into it.
>>>
>>> But One of my applications(a custom browser, Multiple instances of
>>> it), it is not responding to 'Close Group' calls. Nothing happens when
>>> I click 'Close Group'
>>>
>>> The application does not have a mdi form.
>>> The Main form does not have a conventional title bar. An activeX
>>> component (w/ icon, caption, min button, close button, customizable
>>> gradient BG) serve as the title bar.
>>> No any code in QueryUnload event.
>>>
>>> What could be the possible reasons? Ralph was mentioning queryunload,
>>> but I could not see anything in the post addressing the 'close group'
>>> issue. Is there anything I can do in the QueryUnload to make the
>>> application close all its instances?
>>
>> Well, you could certianly try it, but given you don't have a standard
>> titlebar I'm starting to suspect that your app isn't processing
>> WM_CLOSE at all.  What happens when you have a single instance, and
>> just select "Close" from the right-click on the taskbar menu?
>>
>> Since you've chosen to use a non-standard UI, odds are you're going to
>> need to do some message sniffing with Spy++ and probably subclass the
>> hidden top-level window watching for WM_CLOSE.  But your use of the 3rd
>> party tool really means only you can troubleshoot this one.
>
> Why is all the really interesting information always so late in
> coming?
>
> -ralph
> <g>

Always, huh!? <g>

--
..NET: It's About Trust!
http://vfred.mvps.org
Author
2 Sep 2010 1:21 AM
Nobody
I think in your case, with somewhat non-standard window, Windows or Explorer
is confused about which window is the main application window, so it
couldn't find it. Try adding a regular form, and make it invisible, then see
if QueryUnload is called.

"Sneha Menon" <spiderang***@gmail.com> wrote in message
news:51821be3-34bd-4b56-b9c3-cd6e5194254c@q21g2000prm.googlegroups.com...

> Almost certainly, nothing. Windows will just attempt to "close
> nicely", presumably by sending WM_CLOSE to the top-level window, all
> apps in that group.

That's what I had thought. And, as almost all the projects I had
handled was single instance ones I hadn't done any research into it.

But One of my applications(a custom browser, Multiple instances of
it), it is not responding to 'Close Group' calls. Nothing happens when
I click 'Close Group'

The application does not have a mdi form.
The Main form does not have a conventional title bar. An activeX
component (w/ icon, caption, min button, close button, customizable
gradient BG) serve as the title bar.
No any code in QueryUnload event.

What could be the possible reasons? Ralph was mentioning queryunload,
but I could not see anything in the post addressing the 'close group'
issue. Is there anything I can do in the QueryUnload to make the
application close all its instances?

Sneha