Results 1 to 16 of 16

Thread: Showing the app in the task bar

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Sydney, Australia
    Posts
    74

    Unhappy

    This should be something simple, but for some reason it isn't. All my forms have ShowInTaskbar set to True, but when I run it, nothing appears in the taskbar .... I'm confused.

    Any suggestions?


  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Are your forms titleless? If so ...
    Code:
    'show the icon of a titleless form in taskbar tray
    
    Private Declare Function SetWindowLong Lib "user32" _
    Alias "SetWindowLongA" (ByVal hwnd As Long, _
    ByVal nIndex As Long, ByVal dwNewLong As Long) _
    As Long
    
    Private Const GWL_STYLE = (-16)
    Private Const WS_SYSMENU = &H80000
    
    '<<<<<<   Form load  >>>>>>
    
    Private Sub Form_Load()
    Call SetWindowLong(Me.hwnd, GWL_STYLE, WS_SYSMENU)
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    Or try this:

    Code:
    Private Sub Form_Load()
    App.TaskVisible = True
    End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Sydney, Australia
    Posts
    74
    Unfortunately, neither of those tips worked. The first one ade the form titelless, but still didnt show in the task bar. The second did nothing as far as i could tell. Thanks for replying though.

    Any other ideas?

  5. #5
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    try setting the border stlye to BORDERLESS then enter a title for the form, the blue bar at the top woun't show, and is should show in the taskbar
    NXSupport - Your one-stop source for computer help

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Sydney, Australia
    Posts
    74
    I'm not sure if I have a different version of VB to you but, borderless is not an option for border style.

    using borderstyle = None, I couldnt notice any difference. The form has a Caption, but no Title?

    i have VB 6.0 if that makes any difference to the price of fish.

  7. #7
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    I asked the same question a few weeks ago in A Minimize Mystery. I still have not figured it out. If you find the answer, please let me know.

  8. #8
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497

    Minimize problem, any luck?

    I was wondering if you got anywhere on this. I've got this problem too, I read your Minimize Mystery. In my scenario, I've got an exe which shows fine in the task bar and minimizes there, but the forms I'm showing from that exe live in a DLL. I can only get those forms to minimize to the desktop and they don't show at all in the taskbar.

    Just talking out loud and wondering if you-all had any news.
    end war
    stop greed

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Sydney, Australia
    Posts
    74
    nowhere yet I'm afraid, but will keep you posted

  10. #10
    Lively Member
    Join Date
    Oct 1999
    Posts
    90

    Unhappy Possible Explanation

    I'm having the same problem. I looked up some stuff on MSDN, and found this:

    http://support.microsoft.com/support.../Q176/4/68.ASP

    It's an article about form behavior with ActiveX controls, but what it basically said was that modal forms (displayed like Form.Show 1) will NOT show in the taskbar no matter what ShowInTaskbar is set to.

    This is a major problem for me, because I use all my forms like classes, defining them with variables, setting their properties (standard and user-defined) and calling them with their own custom View function, which allows them to start up correctly and show themselves modally, which allows a return value to be sent back when activity is complete. I can't easily change this behavior.

    If anybody has any more info on this or a work around, I'd appreciate it.

    -JoeyCode

  11. #11
    Guest
    All of my forms are modal, but for a work around I've loaded a non-modal form on startup, and kept this form hidden so that the user never sees it. This will bring up the app in the task bar.

    Hope it helps.

  12. #12
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497

    huh

    Can you be more specific about your method?
    end war
    stop greed

  13. #13
    Lively Member
    Join Date
    Oct 1999
    Posts
    90

    Talking My Way or the Highway

    I see what Caspian is doing, just SHOWing a single invisible non-modal form that probably has nothing on it and no code, thusly the app will show in the taskbar, displayed with the caption of that form. That's a pretty good solution, no better or worse than mine below (they're all stupid, since it shouldn't be necessary).

    What I'm doing is calling all my forms with a custom View method (because I'm treating all my forms as separate "classes"), and the forms show themselves modally, like this:

    Code:
    'View Method
    'Set the Default form properties (if any)
            
    'Set flag and show form
    m_ReturnValue = vbCancel
    m_ValidView = True
        
    'Just in case form was called incorrectly...
    Me.Visible = False
            
    'Now show modally
    Me.Show vbModal
        
    'Return the value
    View = m_ReturnValue
    m_ValidView = False
    
    'Done
    Exit Function
    The variable m_ReturnValue allows the form (the View method) to return a value, and the flag m_ValidView is checked in the Form.Activate event...if it's not set to True, the form won't load and will display an error message. This makes it so you can't load the form normally, you have to call the View method. The key here is that when the form shows itself Modally, the code pauses there until the form unloads itself, at which time m_ReturnValue is passed back and control is returned to the calling function. This was also why my app wasn't showing in the Taskbar...but I need it to pause here. So I made this modification:

    Code:
    'View Method
    'Set the Default form properties (if any)
            
    'Set flag and show form
    'm_ReturnValue = vbCancel
    m_ReturnValue = 0 'For new show method
    m_ValidView = True
        
    'Just in case form was called incorrectly...
    Me.Visible = False
            
    'Now show modally
    'Me.Show vbModal
        
    'New show method to allow form to appear in taskbar
    Me.Show vbModeless
    'Loop till it's done
    While m_ReturnValue = 0
        
        DoEvents
            
    Wend
        
    'Return the value
    View = m_ReturnValue
    m_ValidView = False
    
    'Done
    Exit Function
    So now this code will wait until a return value is set, which happens at the same time as the form unloads itself (but it doesn't have to). I was worried about doing this, but there doesn't seem to be any performance hit.

    I don't think any solution is going to be clean, and Caspian's solution is good, but this worked for my situation.

    -JoeyCode

  14. #14
    Guest

    Wink

    Sorry vbmom, haven't had time to respond. JoeyCode did a great job explaining my solution. Thanks!

  15. #15
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497

    Smile Hey thanks

    That worked great, JoeyCode. And gee, was it so simple. I might have to disagree that it doesn't suck up resources. I've got the NT Task Mgr telling me I've got 100% cpu usage when the two forms are showing and the loop thing is running.

    Regardless, I'm glad the ideas were shared. If anything, it's an interesting study. I modified the method to satisfy the requirement that control does not come back to the caller form (the one that loads the DLL form using your custom View function through a DLL class function, right?) until the DLL form is unloaded.

    Calling form...

    Dim LoadClass as New CLoadClass
    (code that disables this form and presents hourglass)
    LoadClass.LoadForm
    (code that enables this form and returns to mouse ptr)

    CLoadClass class...

    Public Sub LoadClass()
    DLLForm.View
    Do
    DoEvents
    Loop Until DLLForm.ViewDone
    Unload DLLForm
    End Sub

    DLLForm's View function is the same as yours *up through* the Me.Show vbModeless.

    DLLForm's ViewDone & QueryUnload functions ...

    Public Function ViewDone() As Boolean
    If m_ReturnValue <> 0 Then ViewDone = True
    End Function

    Public Function QueryUnload...
    m_ReturnValue = vbCancel
    End Function

    I hope this makes sense. Maybe it will be helpful to you.
    end war
    stop greed

  16. #16
    New Member christatedavies's Avatar
    Join Date
    Apr 2003
    Location
    Banbury, United Kingdom
    Posts
    1

    Talking Thanks!!!!!

    Thankyou JoeyCode. I have been looking for a solution to this problem. You are a life saver. Thanks again, Chris.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width