martin2k

Google
 
Web www.martin2k.co.uk

How do I show a modal form in the taskbar?


 

Home

Read and add posts to the Visual Basic 6.0 Forums

Download some of my programs and OCXs

Read the Tips here

The old style forum is still available here

Contact


 

Question

From: George M Patterson
Date: Monday, July 10, 2000 12:04 PM
Subject: VB question
Question: Hello - you helped me out before with a vb question about network neighbourhoods.

Could you possibly help me again?

Is it possible for a modal form to have a caption visible in the task bar?

Cheers.

george

I have tried this before and the only way that I can think of is to have a normal form and then just enable and disable the main form manually as modal forms cannot go into the taskbar.


Comments

From: levs
Date: Monday, November 26, 2007 at 16:22:45
Comments: "The second form would have a 0 width and 0 height so it would not be visible and it would unload itself right after it loaded."

It does not work.

 
From: Matt Ryall
Date: Wednesday, February 2, 2005 at 01:26:49
Comments: The example given by ich breaks the "modal-ness" of the form. Setting Form.Visible to false allows the execution path of the caller to continue (in Sub Main or whatever).
 
From: ich
Date: Tuesday, November 4, 2003 at 16:11:19
Comments:
Private Sub Form_Activate()
 Me.Visible = False
 Me.Caption = Me.Caption
 Me.Visible = True
End Sub
 
From: David Schofield
Date: Wednesday, September 3, 2003 at 22:36:45
Comments: You can accomplish the same thing much easier by minimizing and restoring the form in the form_activate proc. DIM a variable to hold the current state before minimizing and restore it to the previous state for user friendliness.
DS
 
From: Elliott
Date: Tuesday, June 3, 2003 at 18:17:53
Comments: I just figured this one out...

The only way to do this is to show something modally over top of your modal form and change the caption just be for you do it. This worked in VB6 for me.
Example:

-----modMain.bas---------------------

sub main()
    ...
    frmMain.Show vbModal
    ...
End Sub

--------frmMain.frm------------------

Private Sub Command1_Click()
     frmMain.Caption = frmMain.Caption
     MsgBox "Your Form will now have a TaskBar Button!"
End Sub

-------End Form----------

There is a clever way of doing this automatically by using a second form instead of a message box and placing the code in the frmMain Activate event.  The second form would have a 0 width and 0 height so it would not be visible and it would unload itself right after it loaded.


Please fill in the below form if you have any comments or additional information you want to add about the above information.  If you have any Visual Basic 6.0 questions, please visit the ForumAny questions sent using this form will be ignored.

* - Mandatory

*Name: E-mail:

*Comments:

*Please type the following code (your comment will not be accepted without it):


Martin Allen 1999 - 2008.  Last updated Saturday 02 August 2008 03:50:35 PM +0100.