Why would the VB6 exe not show up in the task bar

Folks

My very standard VB6 exe is not showing up on one users task bar in
Windows Vista.  The task bar being that area usually on the bottom of
your screen showing you all the open programs.

Any thoughts?  It works for me on a Vista VPC session as well as
Windows 7.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/6/2010 9:35:19 PM
vb.general.discussion 1016 articles. 0 followers. Follow

30 Replies
1587 Views

Similar Articles

[PageSpeed] 5

"Tony Toews [MVP]" <ttoews@telusplanet.net> wrote in message 
news:ad0ak5hdrlrjr3dc1omare7bunc9fgd964@4ax.com...
> Folks
>
> My very standard VB6 exe is not showing up on one users task bar in
> Windows Vista.  The task bar being that area usually on the bottom of
> your screen showing you all the open programs.
>
> Any thoughts?  It works for me on a Vista VPC session as well as
> Windows 7.

Typically what affects forms appearing in the task bar is ShowInTaskbar 
property. I am not sure what's causing the problem that you mentioned.


0
Nobody
1/6/2010 10:01:30 PM
"Nobody" <nobody@nobody.com> wrote:

>> My very standard VB6 exe is not showing up on one users task bar in
>> Windows Vista.  The task bar being that area usually on the bottom of
>> your screen showing you all the open programs.
>>
>> Any thoughts?  It works for me on a Vista VPC session as well as
>> Windows 7.
>
>Typically what affects forms appearing in the task bar is ShowInTaskbar 
>property. 

Oh, I never noticed that.  It appears all the other forms have that
property set to false which makes sense.

Now it might start to be making some sense if he can open another form
and then somehow close the main form without exiting the program.    

Thanks, this gives me a starting point rather than doubting his
sanity.   <smile> Actually he's very, very good.  We've worked
together off and on for about 10 years.  So his description of his
problem was utterly accurate.  It just didn't make any sense to me.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/7/2010 1:14:34 AM
Check also App.TaskVisible.


0
Nobody
1/7/2010 1:39:06 AM
"Nobody" <nobody@nobody.com> wrote:

>Check also App.TaskVisible.

Didn't have any of that in the code.  But now I can duplicate his
results.

If you open another form and then click on an Exit command button on
the "main" form then the program exits.  The command button runs 
"End".

However if you open another form and close the "main" form using the x
to close button on the right hand side of title bar then just the form
closes.  The other form stays visible but as soon as click on another
Windows program the other form disappears.  And the VB6 exe still
resides in memory.

So I need to run End in the "main" forms Unload event, correct?

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/7/2010 2:44:17 AM
Tony Toews [MVP] wrote:
> "Nobody" <nobody@nobody.com> wrote:
>
>
> So I need to run End in the "main" forms Unload event, correct?
>

Never use "End" statement in a production application. Period. Fine!

Repeat: never use the "End" Statement as it performs minimal "clean-up" if
any.

To properly end a VB application before you close the parent From or exit
Sub Main, you should unload all forms, set any references still in scope to
Nothing, and disable any active Timers. At this point the application should
end on its own. If it doesn't then you are leaving something behind.

It is possible the O/S may eventually perform some clean-up for some system
resources, but you can't count on it, and if it doesn't then you will have a
memory leak.

-ralph






0
Ralph
1/7/2010 2:59:21 AM
"Tony Toews [MVP]" <ttoews@telusplanet.net> wrote

> If you open another form and then click on an Exit command button on
> the "main" form then the program exits.  The command button runs
> "End".

I wonder how many people would use that route if they didn't call it
End, but instead provided an App.Crash method.  That is basically
what End does, crash the program.  As you see it can lead to a
multitude of problems.


> So I need to run End in the "main" forms Unload event, correct?

You should ensure no other code is running, and unload all forms.
That is the proper way to close the application.  Read the remarks
section in VB Help for the End keyword....

LFS


0
Larry
1/7/2010 3:00:57 AM
"Larry Serflaten" <serflaten@usinternet.com> wrote:

>> If you open another form and then click on an Exit command button on
>> the "main" form then the program exits.  The command button runs
>> "End".
>
>I wonder how many people would use that route if they didn't call it
>End, but instead provided an App.Crash method.  That is basically
>what End does, crash the program.  As you see it can lead to a
>multitude of problems.

What problems did using End lead to in my case?  Seems to me that for
what I wanted it to do it worked.

Note that I can appreciate that I'm not supposed to use End.  It's
just that your last sentence doesn't make any sense to my scenario.

>> So I need to run End in the "main" forms Unload event, correct?
>
>You should ensure no other code is running, 

What circumstances would that happen?I don't have any forms running
with timers.

>and unload all forms.

Ok, found the sample code for that.

>That is the proper way to close the application.  Read the remarks
>section in VB Help for the End keyword....

Yup, nice generic warning comments.  It would've been nice for MS to
be a bit more specific.  Oh well.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/7/2010 3:31:13 AM
"Ralph" <nt_consulting64@yahoo.com> wrote:

>> So I need to run End in the "main" forms Unload event, correct?
>>
>
>Never use "End" statement in a production application. Period. Fine!
>
>Repeat: never use the "End" Statement as it performs minimal "clean-up" if
>any.

Ah, ok.     We use DoCmd.Quit all the time in the Access world. 

>To properly end a VB application before you close the parent From or exit
>Sub Main, you should unload all forms, set any references still in scope to
>Nothing, and disable any active Timers. At this point the application should
>end on its own. If it doesn't then you are leaving something behind.

Ok, I don't have any references or timers and I've found the necessary
code to close all forms.  Identical to what I' use in a somewhat
similar situation in Access where I want to ensure I close all
references to the backend database so I can compact the backend or
switch to a different backend.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/7/2010 3:33:59 AM
Tony Toews [MVP] wrote:
> "Ralph" <nt_consulting64@yahoo.com> wrote:
>
>>> So I need to run End in the "main" forms Unload event, correct?
>>>
>>
>> Never use "End" statement in a production application. Period. Fine!
>>
>> Repeat: never use the "End" Statement as it performs minimal
>> "clean-up" if any.
>
> Ah, ok.     We use DoCmd.Quit all the time in the Access world.
>

The DoCmd function is a VBA MSAccess extension. DoCmd.Quit is actually
calling the Host's "Quit" command which is the same as quiting MSAccess - in
which case MSAccess will close its Forms and release Objects, Resources,
&etc.

-ralph



-1
Ralph
1/7/2010 4:17:33 AM
Tony Toews [MVP] submitted this idea :
> "Ralph" <nt_consulting64@yahoo.com> wrote:
>
>>> So I need to run End in the "main" forms Unload event, correct?
>> 
>> Never use "End" statement in a production application. Period. Fine!
>> 
>> Repeat: never use the "End" Statement as it performs minimal "clean-up" if
>> any.
>
> Ah, ok.     We use DoCmd.Quit all the time in the Access world. 

Extra credit reading: http://obob.com/cis58/evilend.html  :-)

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
1/7/2010 10:28:29 PM
Karl E. Peterson <karl@exmvps.org> wrote:

>Extra credit reading: http://obob.com/cis58/evilend.html  :-)

Awesome.  That nicely explains the other comments in this thread.  

And I didn't realize that Bob O'Bob had a website.  <a minute later>
Darn, I wish he had more articles.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/8/2010 1:40:36 AM
Tony Toews [MVP] formulated on Thursday :
> Karl E. Peterson <karl@exmvps.org> wrote:
>
>> Extra credit reading: http://obob.com/cis58/evilend.html  :-)
>
> Awesome.  That nicely explains the other comments in this thread.  
>
> And I didn't realize that Bob O'Bob had a website.  <a minute later>
> Darn, I wish he had more articles.

Yeah, he has a way, alright...  :-)

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
1/8/2010 2:45:12 AM
On Wed, 06 Jan 2010 14:35:19 -0700, "Tony Toews [MVP]"
<ttoews@telusplanet.net> wrote:

>Folks
>
>My very standard VB6 exe is not showing up on one users task bar in
>Windows Vista.  The task bar being that area usually on the bottom of
>your screen showing you all the open programs.
>
>Any thoughts?  It works for me on a Vista VPC session as well as
>Windows 7.

It will not show if the startup object is a module with a Sub Main in
it.
To be visible, the startup object has to be a form.

And the ShowInTaskBar has to be set a t TRUE, of course.

Anyway, that's just what happened to me. To fix it, I had to rewrite a
command line parser and all init function into the main form. Fun...
0
deactivated
1/8/2010 4:18:02 AM
deactivated wrote:

>>My very standard VB6 exe is not showing up on one users task bar in
>>Windows Vista.  The task bar being that area usually on the bottom of
>>your screen showing you all the open programs.
>>
>>Any thoughts?  It works for me on a Vista VPC session as well as
>>Windows 7.
>
>It will not show if the startup object is a module with a Sub Main in
>it.
>To be visible, the startup object has to be a form.
>
>And the ShowInTaskBar has to be set a t TRUE, of course.
>
>Anyway, that's just what happened to me. To fix it, I had to rewrite a
>command line parser and all init function into the main form. Fun...

Hmm, actually I do have a Sub Main.   And if certain conditions are
met the program does some processing, including reading the command
line and exits without displaying any forms.    Assuming no errors of
course.

If other conditions are met then a form is displayed and other forms
can be displayed and so forth. 

So I didn't have to move anything to a form so I find your comment a
bit puzzling.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/8/2010 5:57:35 AM
"deactivated" wrote in message 
news:4b46b138.11165421@news.newshosting.com...
> On Wed, 06 Jan 2010 14:35:19 -0700, "Tony Toews [MVP]"
> <ttoews@telusplanet.net> wrote:
>
>>Folks
>>
>>My very standard VB6 exe is not showing up on one users task bar in
>>Windows Vista.  The task bar being that area usually on the bottom of
>>your screen showing you all the open programs.
>>
>>Any thoughts?  It works for me on a Vista VPC session as well as
>>Windows 7.
>
> It will not show if the startup object is a module with a Sub Main in
> it.
> To be visible, the startup object has to be a form.

That's not true unless you show the form modally.  Modal forms don't show in 
the taskbar unless you do sme API work to force it.

0
Bob
1/8/2010 1:23:49 PM
On Thu, 07 Jan 2010 22:57:35 -0700, "Tony Toews [MVP]"
<ttoews@telusplanet.net> wrote:

>deactivated wrote:

>>It will not show if the startup object is a module with a Sub Main in
>>it.
>>To be visible, the startup object has to be a form.
>>
>>And the ShowInTaskBar has to be set a t TRUE, of course.
>>
>>Anyway, that's just what happened to me. To fix it, I had to rewrite a
>>command line parser and all init function into the main form. Fun...
>
>Hmm, actually I do have a Sub Main.   And if certain conditions are
>met the program does some processing, including reading the command
>line and exits without displaying any forms.    Assuming no errors of
>course.
>
>If other conditions are met then a form is displayed and other forms
>can be displayed and so forth. 
>
>So I didn't have to move anything to a form so I find your comment a
>bit puzzling.

Maybe I wasn't too clear...

The application I was making then had a Sub Main as startup up and
would call a form to show. That worked fine.

However, nothing was shown in the taskbar.

I added some code to display an icon in the taskbar but the client
wanted the program to show in the ALT-tab form where a user can
activate the application directly.

To do that, I had to make the start-up object the main form.

Unless you have some trick about that...?
0
deactivated
1/8/2010 8:35:04 PM
On Fri, 8 Jan 2010 05:23:49 -0800, "Bob Butler" <noway@nospam.ever>
wrote:

>
>"deactivated" wrote in message 
>news:4b46b138.11165421@news.newshosting.com...

>> It will not show if the startup object is a module with a Sub Main in
>> it.
>> To be visible, the startup object has to be a form.
>
>That's not true unless you show the form modally. 

The form called from Sub Main was show modally and the application did
not show in the task bar.
Neither did it show in the ALT-tab form.

>Modal forms don't show in 
>the taskbar unless you do sme API work to force it.

err...did I miss something?

....what APIs ? I want to know...

0
deactivated
1/8/2010 8:40:47 PM
deactivated formulated the question :
> The application I was making then had a Sub Main as startup up and
> would call a form to show. That worked fine.
>
> However, nothing was shown in the taskbar.
>
> I added some code to display an icon in the taskbar but the client
> wanted the program to show in the ALT-tab form where a user can
> activate the application directly.
>
> To do that, I had to make the start-up object the main form.
>
> Unless you have some trick about that...?

Sounds like a mess.  There's nothing magical about showing up in either 
the taskbar or the alt-tab order.  The rules for the latter are very 
clear-cut.  See http://vb.mvps.org/samples/AltTab for the algorithm.

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
1/8/2010 9:07:09 PM
On Fri, 08 Jan 2010 13:07:09 -0800, Karl E. Peterson <karl@exmvps.org>
wrote:

>deactivated formulated the question :
>> The application I was making then had a Sub Main as startup up and
>> would call a form to show. That worked fine.
>>
>> However, nothing was shown in the taskbar.
>>
>> I added some code to display an icon in the taskbar but the client
>> wanted the program to show in the ALT-tab form where a user can
>> activate the application directly.
>>
>> To do that, I had to make the start-up object the main form.
>>
>> Unless you have some trick about that...?
>
>Sounds like a mess.  There's nothing magical about showing up in either 
>the taskbar or the alt-tab order.  The rules for the latter are very 
>clear-cut.  See http://vb.mvps.org/samples/AltTab for the algorithm.

404

http://vb.mvps.org/samples/AltTab/

That last slash is a bitch  ;-)
0
deresoluted
1/8/2010 9:22:34 PM
"deactivated" wrote in message 
news:4b47973d.17716859@news.newshosting.com...
> On Fri, 8 Jan 2010 05:23:49 -0800, "Bob Butler" <noway@nospam.ever>
> wrote:
>
>>
>>"deactivated" wrote in message
>>news:4b46b138.11165421@news.newshosting.com...
>
>>> It will not show if the startup object is a module with a Sub Main in
>>> it.
>>> To be visible, the startup object has to be a form.
>>
>>That's not true unless you show the form modally.
>
> The form called from Sub Main was show modally and the application did
> not show in the task bar.
> Neither did it show in the ALT-tab form.

Right, that's what I said.  If you show it modally then it does not appear 
in the taskbar.  If you don't show the form modally then it will.  The 
problem is not that you are starting from Sub Main, it's that you are 
showing a modal form.

>>Modal forms don't show in
>>the taskbar unless you do sme API work to force it.
>
> err...did I miss something?
>
> ...what APIs ? I want to know...

This works for me, at least through Vista.  I haven't tried it on Win7 yet.

'API to force taskbar icon for modal form
Private Declare Function SetWindowLong Lib "user32" Alias _
  "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
  ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias _
  "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Const WS_EX_APPWINDOW = &H40000
Private Const GWL_EXSTYLE = -20
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
  (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, _
  ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
  (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
  ByRef lParam As Any) As Long
Private Declare Function RegisterWindowMessage Lib "user32" _
  Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long

Private Sub AddToTaskBar()
Dim lStyle As Long
Dim lResult As Long
Dim lHook As Long
Dim lTrayhWnd As Long
Dim lTBhWnd As Long
lStyle = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
lResult = SetWindowLong(Me.hWnd, GWL_EXSTYLE, lStyle Or WS_EX_APPWINDOW)
lHook = RegisterWindowMessage("SHELLHOOK")
lTrayhWnd = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString)
If lTrayhWnd <> 0 And lHook <> 0 Then
  lTBhWnd = FindWindowEx(lTrayhWnd, 0, "RebarWindow32", vbNullString)
  If lTBhWnd Then
    lTBhWnd = FindWindowEx(lTBhWnd, 0, "MSTaskSwWClass", vbNullString)
    If lTBhWnd Then
      lResult = PostMessage(lTBhWnd, lHook, 1, ByVal Me.hWnd)
    End If
  End If
End If
End Sub

Private Sub Form_Activate()
Static bDone As Boolean
If Not bDone Then
  bDone = True
  AddToTaskBar
End If
End Sub

0
Bob
1/8/2010 9:57:02 PM
Karl E. Peterson <karl@exmvps.org> wrote:

>Sounds like a mess.  There's nothing magical about showing up in either 
>the taskbar or the alt-tab order.  The rules for the latter are very 
>clear-cut.  See http://vb.mvps.org/samples/AltTab for the algorithm.

Thanks Karl.  I'm gong to be needing that logic in a month or two.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/8/2010 9:58:52 PM
deresoluted laid this down on his screen :
> On Fri, 08 Jan 2010 13:07:09 -0800, Karl E. Peterson <karl@exmvps.org>
> wrote:
>
>> deactivated formulated the question :
>>> The application I was making then had a Sub Main as startup up and
>>> would call a form to show. That worked fine.
>>> 
>>> However, nothing was shown in the taskbar.
>>> 
>>> I added some code to display an icon in the taskbar but the client
>>> wanted the program to show in the ALT-tab form where a user can
>>> activate the application directly.
>>> 
>>> To do that, I had to make the start-up object the main form.
>>> 
>>> Unless you have some trick about that...?
>> 
>> Sounds like a mess.  There's nothing magical about showing up in either 
>> the taskbar or the alt-tab order.  The rules for the latter are very 
>> clear-cut.  See http://vb.mvps.org/samples/AltTab for the algorithm.
>
> 404
>
> http://vb.mvps.org/samples/AltTab/
>
> That last slash is a bitch  ;-)

Huh?  ("Works here.")

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
1/8/2010 10:37:59 PM
on 1/8/2010, Tony Toews [MVP] supposed :
> Karl E. Peterson <karl@exmvps.org> wrote:
>
>> Sounds like a mess.  There's nothing magical about showing up in either 
>> the taskbar or the alt-tab order.  The rules for the latter are very 
>> clear-cut.  See http://vb.mvps.org/samples/AltTab for the algorithm.
>
> Thanks Karl.  I'm gong to be needing that logic in a month or two.

We developed that logic in NT 3.5 and Windows 3.1, so you'll have to 
let me know how that goes in Windwos 7... <gd&r>

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
1/8/2010 10:39:53 PM
On Fri, 8 Jan 2010 13:57:02 -0800, "Bob Butler" <noway@nospam.ever>
wrote:

>
>
>"deactivated" wrote in message 
>news:4b47973d.17716859@news.newshosting.com...

>Right, that's what I said.  If you show it modally then it does not appear 
>in the taskbar.  If you don't show the form modally then it will.  The 
>problem is not that you are starting from Sub Main, it's that you are 
>showing a modal form.

I just tried it and you are right.
I have never tried calling a non-modal form from the sub Main....since
when the main form is unloaded, I set it to nothing explicitly...

One does learn every day.

>> ...what APIs ? I want to know...
>
>This works for me, at least through Vista.  I haven't tried it on Win7 yet.

This I will try....

>'API to force taskbar icon for modal form
>Private Declare Function SetWindowLong Lib "user32" Alias _
>  "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
>  ByVal dwNewLong As Long) As Long
>Private Declare Function GetWindowLong Lib "user32" Alias _
>  "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
>Private Const WS_EX_APPWINDOW = &H40000
>Private Const GWL_EXSTYLE = -20
>Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
>  (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, _
>  ByVal lpClassName As String, ByVal lpWindowName As String) As Long
>Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
>  (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
>  ByRef lParam As Any) As Long
>Private Declare Function RegisterWindowMessage Lib "user32" _
>  Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long
>
>Private Sub AddToTaskBar()
>Dim lStyle As Long
>Dim lResult As Long
>Dim lHook As Long
>Dim lTrayhWnd As Long
>Dim lTBhWnd As Long
>lStyle = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
>lResult = SetWindowLong(Me.hWnd, GWL_EXSTYLE, lStyle Or WS_EX_APPWINDOW)
>lHook = RegisterWindowMessage("SHELLHOOK")
>lTrayhWnd = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString)
>If lTrayhWnd <> 0 And lHook <> 0 Then
>  lTBhWnd = FindWindowEx(lTrayhWnd, 0, "RebarWindow32", vbNullString)
>  If lTBhWnd Then
>    lTBhWnd = FindWindowEx(lTBhWnd, 0, "MSTaskSwWClass", vbNullString)
>    If lTBhWnd Then
>      lResult = PostMessage(lTBhWnd, lHook, 1, ByVal Me.hWnd)
>    End If
>  End If
>End If
>End Sub
>
>Private Sub Form_Activate()
>Static bDone As Boolean
>If Not bDone Then
>  bDone = True
>  AddToTaskBar
>End If
>End Sub
>

0
bitshifter
1/9/2010 3:12:35 AM
On Sat, 09 Jan 2010 03:12:35 GMT, bitshifter@sympatico.ca wrote:

>>This works for me, at least through Vista.  I haven't tried it on Win7 yet.
>
>This I will try....

....and it works really fine.
Another addition to my library of tricks from others...

Multi-tanks to you.

>>'API to force taskbar icon for modal form
>>Private Declare Function SetWindowLong Lib "user32" Alias _
>>  "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
>>  ByVal dwNewLong As Long) As Long
>>Private Declare Function GetWindowLong Lib "user32" Alias _
>>  "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
>>Private Const WS_EX_APPWINDOW = &H40000
>>Private Const GWL_EXSTYLE = -20
>>Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
>>  (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, _
>>  ByVal lpClassName As String, ByVal lpWindowName As String) As Long
>>Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
>>  (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
>>  ByRef lParam As Any) As Long
>>Private Declare Function RegisterWindowMessage Lib "user32" _
>>  Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long
>>
>>Private Sub AddToTaskBar()
>>Dim lStyle As Long
>>Dim lResult As Long
>>Dim lHook As Long
>>Dim lTrayhWnd As Long
>>Dim lTBhWnd As Long
>>lStyle = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
>>lResult = SetWindowLong(Me.hWnd, GWL_EXSTYLE, lStyle Or WS_EX_APPWINDOW)
>>lHook = RegisterWindowMessage("SHELLHOOK")
>>lTrayhWnd = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString)
>>If lTrayhWnd <> 0 And lHook <> 0 Then
>>  lTBhWnd = FindWindowEx(lTrayhWnd, 0, "RebarWindow32", vbNullString)
>>  If lTBhWnd Then
>>    lTBhWnd = FindWindowEx(lTBhWnd, 0, "MSTaskSwWClass", vbNullString)
>>    If lTBhWnd Then
>>      lResult = PostMessage(lTBhWnd, lHook, 1, ByVal Me.hWnd)
>>    End If
>>  End If
>>End If
>>End Sub
>>
>>Private Sub Form_Activate()
>>Static bDone As Boolean
>>If Not bDone Then
>>  bDone = True
>>  AddToTaskBar
>>End If
>>End Sub
>>
>

0
bitshifter
1/9/2010 3:21:45 AM
Karl E. Peterson <karl@exmvps.org> wrote:

>>> Sounds like a mess.  There's nothing magical about showing up in either 
>>> the taskbar or the alt-tab order.  The rules for the latter are very 
>>> clear-cut.  See http://vb.mvps.org/samples/AltTab for the algorithm.
>>
>> Thanks Karl.  I'm gong to be needing that logic in a month or two.
>
>We developed that logic in NT 3.5 and Windows 3.1, so you'll have to 
>let me know how that goes in Windwos 7... <gd&r>

Hehehehe.   All I really need is the list of active tasks.  I don't
care about the icons and such.  

What I'm really looking for is the ability to warn someone that
they're already running the Access app and are they sure they want to
run it a second time?  Or ensure they can't run it a second time.  Now
what is complicating things here is that it's easy to determine this
from inside the Access app as you can look at the current title and
compare it to other existing titles.  I want to do this external to
Access so I think I'm going to setup some kind of "learning mode" in
my VB6 exe.

That said I can also look to the see if the current Access FE has an
LDB file open.  Trouble is it appears I can't use that for ADP/ADEs.
So it gets complicated.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
1/10/2010 5:22:31 AM
Tony Toews [MVP] explained on 1/9/2010 :
> Karl E. Peterson <karl@exmvps.org> wrote:
>
>>>> Sounds like a mess.  There's nothing magical about showing up in either 
>>>> the taskbar or the alt-tab order.  The rules for the latter are very 
>>>> clear-cut.  See http://vb.mvps.org/samples/AltTab for the algorithm.
>>> 
>>> Thanks Karl.  I'm gong to be needing that logic in a month or two.
>> 
>> We developed that logic in NT 3.5 and Windows 3.1, so you'll have to 
>> let me know how that goes in Windwos 7... <gd&r>
>
> Hehehehe.   All I really need is the list of active tasks.  I don't
> care about the icons and such.

That AltTab sample actually has two modes of detection.  One provides 
all the tasks that show up in the AltTab dialog.  The other shows all 
the tasks that show up in the Applications tab of Task Manager.

> What I'm really looking for is the ability to warn someone that
> they're already running the Access app and are they sure they want to
> run it a second time?  Or ensure they can't run it a second time.  Now
> what is complicating things here is that it's easy to determine this
> from inside the Access app as you can look at the current title and
> compare it to other existing titles.  I want to do this external to
> Access so I think I'm going to setup some kind of "learning mode" in
> my VB6 exe.

You might find the FindPart example on my site useful.  It'll run 
through all the running tasks, looking for titles that partially match 
a given string.  Might at least be a good starting point.

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
1/11/2010 8:46:40 PM
Karl E. Peterson wrote:
> Tony Toews [MVP] formulated on Thursday :
>> Karl E. Peterson <karl@exmvps.org> wrote:
>>
>>> Extra credit reading: http://obob.com/cis58/evilend.html  :-)
>>
>> Awesome.  That nicely explains the other comments in this thread. 
>> And I didn't realize that Bob O'Bob had a website.  <a minute later>
>> Darn, I wish he had more articles.
> 
> Yeah, he has a way, alright...  :-)
> 


thank you both.

Maybe one day there might be another appearance of VBCurmudgeon.com



	Bob
-- 
0
Bob
4/8/2010 1:10:29 AM
Bob O`Bob wrote:
> Karl E. Peterson wrote:
>> Tony Toews [MVP] formulated on Thursday :
>>> Karl E. Peterson <karl@exmvps.org> wrote:
>>>
>>>> Extra credit reading: http://obob.com/cis58/evilend.html  :-)
>>>
>>> Awesome.  That nicely explains the other comments in this thread. And I 
>>> didn't realize that Bob O'Bob had a website.  <a minute later>
>>> Darn, I wish he had more articles.
>> 
>> Yeah, he has a way, alright...  :-)
>
> thank you both.
>
> Maybe one day there might be another appearance of VBCurmudgeon.com

I'd welcome that day, myself.  :-)

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
4/8/2010 7:01:35 PM
Bob O`Bob <filterbob@yahoogroups.com> wrote:

>>>> Extra credit reading: http://obob.com/cis58/evilend.html  :-)
>>>
>>> Awesome.  That nicely explains the other comments in this thread. 
>>> And I didn't realize that Bob O'Bob had a website.  <a minute later>
>>> Darn, I wish he had more articles.
>> 
>> Yeah, he has a way, alright...  :-)
>> 
>
>
>thank you both.

You're welcome.

>Maybe one day there might be another appearance of VBCurmudgeon.com

Hehehehe  Looking forward to it.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
0
Tony
4/15/2010 7:10:03 PM
Reply:

Similar Artilces:

xsd.exe (version 1.1) can't deal with <xs:annotation>?
Hi all, in the following situation: <xs:element name="Type"> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="I"/> <xs:enumeration value="J"/> <xs:enumeration value="P"> <xs:annotation>P will occur for Primary.</xs:annotation> </xs:enumeration> <xs:enumeration value="S"> <xs:annotation>S will occur for Secondary.</xs:annotation> </xs:enumeration> </xs:restriction> </xs:simpleType> </xs:element> which...

Inventory standard cost not showing up in PO
I have a GP10 environment running inventory and POP. It is not running mfg. I have my inventory cost set to standard cost. When I create a PO for one of my items, the standard cost don't show up in inventory. I got it to work in my test company but for some reason it doesn't want to cooperate in production Does anyone have any idea what I might be missing? Many thanks.. -- Jim Jim, dumb question, but are you sure MFG isn't activated in your test environment? You shouldn't be able to update the Standard Cost field unless it is. Frank Hamelly MCP-GP, M...

Show a message if there are some duplicates
Hi I have a worksheet with 4 columns as the first one should contain only unique value I use conditional formatting to highlight duplicates. I also use for that column Data Validation as I want to restric the user to a certain format. Now I would like a formula in a cell that would do this "If there are some duplicate in column A4:A300 "You have some duplicate, please correct them" unless no mesage a bit like = if (****** = True, "Please correct", "") I repeat Data Validation is already used for another purpose Thanks for helping In case you weren'...

How to create digital cert from SelfCert.exe?
For office 2003, when I try to create a new digital cert from selfcert, I get following error, does anyone have any suggestions on how to solve it? Thanks in advance for any suggestionsE Eric "An error occurred while establishing digital cert Selfcert can not establish your digital cert" Have you read my reply to your posting of a couple days ago? 26cbt5hgehtiklhr07bijubrq2qihl888v@4ax.com Gord Dibben MS Excel MVP On Tue, 27 Apr 2010 08:30:02 -0700, Eric <Eric@discussions.microsoft.com> wrote: >For office 2003, when I try to create a new digital...

how to disable formula bar?
I have produced a quiz worksheet - all the answers are below the input cells - in an 'if' statement. I have used protection to hide them, only allowing input in the appropriate cells... But the user can still select; View - formula bar, and thereby see the formulae containing the answers - how can I stop this? Thanks Ric You can lock the cells with the formulas (format|cells|protection tab, but check locked and Hidden) And unlock all the cells that should allow user input. Then tools|protection|protect sheet give it a nice password and your formulas will be hidden. That sa...

Creating and sanding tasks from Access VBA
Hi, I am using Outlook 2003 with Exchange 2007 and I am trying to programatically send tasks from access vba to another account. thenks. Did you have a specific question? Please show your code. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "ACCESS 2003" wrote: > Hi, > I am using Outlook 2003 with Exchange 2007 and I am trying to > programatically send tasks from access vba to another account. > > thenks. Hi, Th...

need a sql FUNCTION to show subscript with integer
Hi All I have a requirement in which I need to get numeric data, and return it in the form of string but with subscript. Eg: 1 -> 1st 2 -> 2nd 3 -> 3rd 4 -> 4th 21 -> 21st 25 -> 25th Do we have such in-built function in MS SQL? Please revert asap. There is no built-in function for ordinals, but you can easily create one. Here is example: CREATE TABLE Nums ( n INT NOT NULL PRIMARY KEY); INSERT INTO Nums(n) VALUES(1); INSERT INTO Nums(n) VALUES(2); INSERT INTO Nums(n) VALUES(3); INSERT INTO Nums(n) VALUES(4); INSERT INTO Nums(n) VALUES(21); IN...

How to handle Units changed in Tasks
Hi I have a Task which I know will take 80h and I have assigened a resource 50% units. When tha task in 50% complete I need to change the units to 25%. When I do this change Ms Project update the project accordingly, but I loose the information that I got 50% units during the first half of the task. How are you supposed to work with Ms Project if you want to keep track of the Unit changes during the lifetime of a task? Regards /Niklas Hello Niklas, You can edit the number of hours per day or per week that the resource works on a task in the Task Usage or Resource Usage view....

conditionally show fields or tabs
allow users to conditionally show fields or tabs based on the contents of another field ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=5244c69b-56c2-4c18-8d1e-70923493ff9a...

Excel Autoshape tool bar
I used the excel autoshape toolbar for the first time. Now the drop down toolbox always appears in excel spreadsheets. I can't get rid of it. In "View" "Toolbars" the only option I get is Customise, but it won't let me add or delete or modify my toolbars any more. Please help On the left edge of the toolbar (assuming it's on the top or bottom of the screen) you'll see a column of tiny hash marks. Position your mouse over it, and the mouse cursor will change to a 4-way arrow. Click on the toolbar and drag it into the middle of the screen. Then, a standard...

Show Email Address, Not Name
How would one show the email address in Outlook in addition to the normal "From" field? G-Diddy <jasongeiger@gmail.com> wrote: > How would one show the email address in Outlook in addition to the > normal "From" field? What you see in the From field is controlled by the sender. -- Brian Tillman Surely not. The email client surely can see the email address sent from? As you see in Outlook Express? Angus "Brian Tillman" <tillman1952@yahoo.com> wrote in message news:#fHcPrwjGHA.4512@TK2MSFTNGP04.phx.gbl... > G-Diddy <jasongeiger@gmail...

How Do I create a table in excel that shows frequency?
Working on an assignment for school and I can't find the right function/table to show me how to create a table showing frequency and relative frequency. Suppose your data is in A1:A100 and has values in range 0 to 100 1) In C1:C10 enter 10,20, 30...100 This is called the BIN 2) Select D1:D10, type =FREQUENCY(A1:A100, C1:C10, and press SHIFT+CTRL+ENTER If all your numbers are the same or you just get value in D1 you did not follow instructions! Now you have the frequency data: D1 is count of data in A1:A100 that is 10 or less; D2 is count for 11 to 20 3) In E1 enter =D1/COUNT($A$1:$A$...

How to remove CRM Tasks from my Outlook
I have installed my CRM Client for Outlook and found that all my assiged tasks from CRM also now appear in outlook. I can understand this is by design, but as also connect to my outlook from home and use tasks for private stuff, is there anyway to disable this ? Fares This doesn't have to be a problem. When you use Tasks for private stuff and you create them in Outlook at home, you just don't use the "Track in CRM" button on that task. That way your personal tasks don't end up in CRM. However, if you don't want to synchronize tasks at all, you could take a lo...

VB6
Can I call VB6 dll's and use them from within MS CRM ? Tx, Siska Hi Siska, Of course. They are COM dlls and can be called from .NET. Stephen "Siska Bossuyt" <siskab@microsoft.com> wrote in message news:ODK1qjGsEHA.2588@TK2MSFTNGP12.phx.gbl... > Can I call VB6 dll's and use them from within MS CRM ? > > Tx, > > Siska > > ...

Outlook.exe erros
Hello, This was not a problem untile several of our users starting complaining about this error. Outlook.exe has generated errors and will be closed by Windows. This happens at random times of the day and both laptops and desktops. Our environment consists of E2K SP3 Office 2K SP3 W2K SP4 I have followed the recommendations in Q297010 and the problem goes away for a couple of days but then comes back. I have also uninstalled Office but the problem will come back. I have re service packed both W2K and Office 2K with no success I have used different virus scanners to check for viruses and ...

Flash animation not showing up in Outlook 2003
We have a machine here with Outlook 2003 loaded on it and whenever it receives an HTML email it will not show Flash animations. Any idea on how to fix this? Or a workaround? ...

How to get disk size in VB6
Hello, Can somebody tell me what VB6 code i need to get the size of a disk? Thanks in advance Bu "Bu" <si@si.si> wrote in message news:a63tf5tiqupm6vo5amut3u4erdju6ai2gc@4ax.com... > Hello, Can somebody tell me what VB6 code > i need to get the size of a disk? Have a look at the following (make sure you read some of the important notes): http://msdn.microsoft.com/en-us/library/aa364937(VS.85).aspx Here's how you can use it in VB6: Mike Option Explicit Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" _ Alias "G...

Access 2007 Special Effect Text Box Won't show Sunken with Window XP
Hi All I am just getting to grips with Access 2007 and one of the quirks I have found is that when I design using Windows in XP Windows-Classic colors and set the text boxes on forms' special effect property to "sunken" They appear as sunken in the correct manner. However, when I change to the Windows XP color scheme the forms text boxes appear flat even though the special effect property has not changed. Any ideas or is it a new quirk we have to live with. I haven't tried it with Vista yet. That should be interesting Thanks Bob "bobdydd" <reallyuseful2004...

Why is OWA blocking exe's??
We're running a pure Ex2k3 (SP2) environment. All DC's are Win2k3 (SP1). I'm trying to post an executable to a public folder, however access to it is being blocked by OWA (it's fine in standard Outlook). The message is "Access to the following potentially unsafe attachments has been blocked". I've used the instructions in the links below to edit the registry on our OWA server, but it hasn't fixed anything. I've also removed .exe from the Level 1 and Level 2 file types. Any ideas what i'm missing? It's just an .exe file.. http://support.micro...

remove previous vb6 project versions from Control Panel
Hello I use the package and deployment tool in vb6 to setup and install my vb6 projects on computers. After installing the project a few times on the same computer, I noticed different versions in the Software-screen in control panel. And I also noticed that pdw doesn't overwrite the program I wanted to install with pdw on that computer. Do you have a solution? Thanks Catharinus van der Werf csvanderwerf@planet.nl catharinus wrote: > Hello > > I use the package and deployment tool in vb6 to setup and install my > vb6 projects on computers. After installing ...

how do i show figures as words?
I'm sure I've seen a spreadsheet where a number was entered into a cell, and there was another cell which must have contained a formula to show that figure in words (eg. for writing a cheque), does anybody out there know how to do this? It's probably really simple!! Cheers Carolyn See http://www.xldynamic.com/source/xld.xlFAQ0004.html -- HTH Bob Phillips "Carolyn" <Carolyn@discussions.microsoft.com> wrote in message news:89E0BBB2-F03E-4383-8BA1-3F0F40AA52AB@microsoft.com... > I'm sure I've seen a spreadsheet where a number was entered into a ce...

bank activity not showing up
When I look at my bank account, the balance is correct, but some of the debits and charges that appear on my bank's website (BofA) do not appear in Money 2005: however -- the balance is correct. Can anyone explain this to a moron like me? What am I missing? -- Cheers, Tom G. In microsoft.public.money, Tom G wrote: >When I look at my bank account, the balance is correct, but some of the >debits and charges that appear on my bank's website (BofA) do not appear in >Money 2005: however -- the balance is correct. > >Can anyone explain this to a moron like me? What...

Help - another question related to rules
Hi: I do seem to be experiencing difficulties with rules these days....... I created a rule that includes having the server respond with a specific message (in fact, all the rule does is to have the server respond with a particular message). The rule is working - I know that since I can sent a test message and receive the appropriate response back. The problem is that there is nothing in the account to indicate that the response was actually sent - I would have thought that the sent messages would show up in my sent messages folder. Am I doing something wrong. Can anyone shed some ...

2002-2000 (or VB6.3-VB6.0) problem
I have a macro in a spreadsheet in my machine (Office XP) produced using Record Macro. On a friends machine (Office 2000) it fails at the following line Selection.SORT Key1:=Range("o3"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal with 'xlSortNormal' highlighted. Anyone throw any light on this. He seems to have VB6.0 while mine is 6.3 if that is relevant Saving the sheet on my machine as 'Excel 97-2002 & 5.0/95 Workbook' does not seem to alter the macro. ...

Where can I get the DSAdiag.exe?
Hi! I'm having problem with our Exchange 2003 Server regarding the DSAccess issue. I really need this tool to troubleshoot the problem. I searched for this tool on google and microsoft but couldn't find anything. Please kindly let me know where to download this tool.Thanks. ...