Private Sub SetStyle()
Dim lWindowStyle As Long
lWindowStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
lWindowStyle = lWindowStyle And WS_EX_TOOLWINDOW
SetWindowLong Me.hwnd, GWL_EXSTYLE, lWindowStyle
End Sub
Private Sub Form_Initialize()
SetStyle
End Sub
This here will remove the taskbar button of your form when the form is initialized. It could be useful if you want to provide your users with an option particularly in MDI applications. In an app that I worked on a long while ago some users wanted the MDI childs button in the taskbar and others did not. So I gave them an option which would take effect the next time they opened an instance of the child form.
I hope someone finds a use for this technique.
One thing I havn't been able to do however is that I have not fount a way to change this setting without unloading the form first. Happy coding...
____________________________
My boss is a Jewish Carpenter (Jesus Christ)
In VB 6.0 u can do the same thing by setting the showintaskbar property of the form to true or false. I couldnt understand the reason for using the APIs. Also what do u mean by VB.OLD? Please explain.
thanks in anticipation
____________________________
Life is at Stake; Make the most out of it!
15-01-2004 at 12:12 AM
|
Goran Level: Moderator Registered: 16-05-2002 Posts: 1681
Re: ShowInTaskBar behavior at Runtime
He ment exactly what he said. You cant change ShowInTaskBar property AT RUN TIME in VB.OLD = Previous VB versions. So, to do it at run time, you need to use API BEFORE the form is loaded, or it will not take effect.
[Edited by Goran on 15-01-2004 at 04:08 PM GMT]
____________________________
If you find the answer helpful, please mark this topic as solved.
15-01-2004 at 02:52 PM
|
fabulous Level: VB Guru Registered: 03-08-2002 Posts: 439
Re: ShowInTaskBar behavior at Runtime
Thanx Goran,
that is exactly what I meant. VB.OLD refers to versions of VB before VB.NET. VB.NET allows you to change this at runtime inherently but in VB.OLD you have to do it at design time or use this (or similar) code.
____________________________
My boss is a Jewish Carpenter (Jesus Christ)
I really thank u both for the suggestions. I here make a special vote of thanx to fabulous 4 the code. I am really sorry to have send a reply like that. Actually I didnt know that this property cant be changed at runtime.
Anyway thanx a lot.
____________________________
Life is at Stake; Make the most out of it!
17-01-2004 at 12:32 PM
|
fabulous Level: VB Guru Registered: 03-08-2002 Posts: 439
Re: ShowInTaskBar behavior at Runtime
No problem thirumalaicb, no offense taken. We learn something new everyday.
I am just glad that you found it helpful and that it gave you some insight. Happy coding.
____________________________
My boss is a Jewish Carpenter (Jesus Christ)