dcsimg
Results 1 to 10 of 10

Thread: [RESOLVED] VB6 Apps and Windows Task Bar Not Retracting

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2017
    Posts
    366

    Resolved [RESOLVED] VB6 Apps and Windows Task Bar Not Retracting

    Also see related post:
    http://www.vbforums.com/showthread.p...stants-Defined

    OS Windows 7.
    Based on the number of internet posts about the Windows Task bar Not retracting it appears it has been an issue for some time.
    New issue to me.
    M$ seems to indicate that the problem rests with whatever Apps may be on the taskbar (one or more depending on users system) AND is NOT a WIndows problem.

    My taskbar is at the bottom of the screen,

    My taskbar just started NOT retracting for the first time.
    I have 3 apps shown on the taskbar:
    1) A 3rd party App written in JAVA that provides a linkage (TCP/IP) to the third party server.
    2) A VB server App (written by me) that interacts with #1
    and includes a GUI visible to the user if desired.
    3) A VB chart App (written by me) that interacts with #2.

    What I found is SOMETIMES when the VB server App is minimized, the taskbar will not retract. However if the VB server App GUI is shown (maximized), the taskbar then appears to reset itself and works as designed (retracts) even with the VB server App minimized. However, on a random basis will NOT retract again sometime in the future.

    Any ideas how to troubleshoot this ?
    Last edited by vb6forever; Jan 17th, 2019 at 08:28 PM.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,862

    Re: VB6 Apps and Windows Task Bar Not Retracting

    Not sure what you mean by "retract"

    Are you referring to the auto hide feature of the taskbar or something else?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2017
    Posts
    366

    Re: VB6 Apps and Windows Task Bar Not Retracting

    Are you referring to the auto hide feature of the taskbar
    Yes. Taskbar stays in full locked position even though UNLOCKED.
    Only checkbox = true is AUTOHIDE.

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,862

    Re: VB6 Apps and Windows Task Bar Not Retracting

    Locked and auto hide are two different things. Locked means that the taskbars size and location are locked so it can't be resized or moved by the user. Autohide means that it will hide itself.

    I personally never use autohide and always use locked so I have never saw the issue you speak of.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2017
    Posts
    366

    Re: VB6 Apps and Windows Task Bar Not Retracting

    Thanks for responding. Will leave thread open.
    As previously stated -- based on internet posts -- number of people with this issue using different Apps and different Windows OSes.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2017
    Posts
    366

    Re: VB6 Apps and Windows Task Bar Not Retracting

    Appears I may have this "manually" resolved:
    Under Window 7, taskbar is set to AutoHide.
    -------------
    Background
    -------------
    I have an MDI app where I shell to another program from that MDI.
    The shelled program can be pushed back or put on top of the MDI, as well as
    minimized to the taskbar. While the taskbar autohide allows me to maximize the shelled program from the taskbar, it -- at times -- would NOT retract (resize / hide itself) enough to show the bottom of the MDI.

    --------------
    My Solution
    --------------
    After the first start of the shelled program from the MDI, I then minimize it.
    While it is minimized I pin it to the taskbar.
    This seems to resolve the problem for any future interaction with the taskbar and the shelled program.

    -----------
    To DO
    -----------
    Doing this from code would be great.
    Am pursing this .

    Code:
    Const CSIDL_COMMON_PROGRAMS = &H17
    Const CSIDL_PROGRAMS = &H2
    Const CSIDL_STARTMENU = &HB
    
    
    Dim objShell, objFSO
    Dim objCurrentUserStartFolder
    Dim strCurrentUserStartFolderPath
    Dim objAllUsersProgramsFolder
    Dim strAllUsersProgramsPath
    Dim objFolder
    Dim objFolderItem
    Dim colVerbs
    Dim objVerb
    
    
    Set objShell = CreateObject("Shell.Application")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
    strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
    Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
    strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
    
    
    ' - Pin to Taskbar -
    
    
    'Microsoft Outlook 2013
    If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office 2013\Outlook 2013.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office 2013")
        Set objFolderItem = objFolder.ParseName("Outlook 2013.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
        Next
    End If
    
    'Snipping Tool
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Snipping Tool.lnk") Then
        Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
        Set objFolderItem = objFolder.ParseName("Snipping Tool.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
        Next
    End If
    
    'Delete the script
    DeleteSelf
    
    
    Sub DeleteSelf()       
            Dim objFSO
            'Create a File System Object
            Set objFSO = CreateObject("Scripting.FileSystemObject")
            'Delete the currently executing script
            objFSO.DeleteFile WScript.ScriptFullName
            Set objFSO = Nothing
    End Sub
    Last edited by vb6forever; Jan 11th, 2019 at 12:00 PM. Reason: Add sample code

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,115

    Re: VB6 Apps and Windows Task Bar Not Retracting

    I detest the "Pown My Taskbar" feature myself and never use it. Instead I restored the QuickLaunch toolbar which gives me more control.

    I installed a program that tried to "Pown" the Taskbar itself and had enough. I disabled the feature by Group Policy setting.

    You may find that a lot of PCs in managed networks have the feature disable as well to prevent users and programs from doing it.


    How did that program manage to pin itself to my taskbar when I installed it?

  8. #8
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,234

    Re: VB6 Apps and Windows Task Bar Not Retracting

    Well given my open disdain for FSO I'd be remiss if I didn't provide a method for doing this without it...

    In a project with oleexp.tlb and mIID.bas...
    Code:
    Private Declare Function CreatePopupMenu Lib "user32" () As Long
    Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
    Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
    Private Declare Function DestroyMenu Lib "user32" (ByVal hMenu As Long) As Long
    
    
    Private Sub InvokePin(sItem As String)
    Dim pcm As IContextMenu
    Dim si As IShellItem
    
    oleexp.SHCreateItemFromParsingName StrPtr(sItem), Nothing, IID_IShellItem, si
    If (si Is Nothing) = False Then
        si.BindToHandler 0&, BHID_SFUIObject, IID_IContextMenu, pcm
        If (pcm Is Nothing) = False Then
            InvokeVerb pcm, "taskbarpin" 'I found this from similar code to below that outputs all available verbs, let me know if you want that too.
        End If
    End If
    End Sub
    
    Private Function InvokeVerb(pCtxMenu As oleexp.IContextMenu, ByVal pszVerb As String, Optional lFlags As InvokeCommandMask = 0&) As Long
    On Error GoTo InvokeVerb_Err
    Dim hMenu As Long
    Dim tCmdInfo As oleexp.CMINVOKECOMMANDINFO
    hMenu = CreatePopupMenu()
    Dim sVerb As String
    sVerb = pszVerb
    Dim lpCtxMenud As Long
    Dim nItems As Long
    Dim i As Long
    Dim bGo As Boolean
    lpCtxMenud = -1
    If hMenu Then
        If (pCtxMenu Is Nothing) = False Then
            pCtxMenu.QueryContextMenu hMenu, 0&, 1&, &H7FFF, CMF_EXPLORE Or CMF_OPTIMIZEFORINVOKE
            nItems = GetMenuItemCount(hMenu)
            For i = 0 To nItems - 1
                lpCtxMenud = GetMenuItemID(hMenu, i)
                If lpCtxMenud <= 0 Then GoTo nxt
                On Error Resume Next
                sVerb = String$(MAX_PATH, 0&)
                pCtxMenu.GetCommandString lpCtxMenud - 1, GCS_VERBW, 0&, StrPtr(sVerb), Len(sVerb)
                On Error GoTo InvokeVerb_Err
                If (Err.Number = 0&) Then
                    sVerb = TrimNullW(sVerb)
                    If LCase$(sVerb) = LCase$(pszVerb) Then
                        bGo = True
                        Exit For
                    End If
                Else
                    Err.Clear
                End If
    nxt:
            Next i
            If bGo Then
                tCmdInfo.cbSize = Len(tCmdInfo)
                tCmdInfo.hWnd = 0& 'Or substitute your context menu's owner hwnd
                tCmdInfo.lpVerb = lpCtxMenud - 1&
                tCmdInfo.fMask = lFlags
                tCmdInfo.nShow = SW_SHOWNORMAL
                pCtxMenu.InvokeCommand VarPtr(tCmdInfo)
            End If
            Call DestroyMenu(hMenu)
        End If
    End If
    
    Exit Function
    
    InvokeVerb_Err:
        Debug.Print "InvokeVerb->" & Err.Description & " (" & Err.Number & ")"
    End Function
    
    Private Function TrimNullW(startstr As String) As String
       TrimNullW = Left$(startstr, lstrlenW(ByVal StrPtr(startstr)))
    End Function
    Unpin is trivial because MS provides an interface for it;
    Code:
    Private Sub UnPin(sItem As String)
    Dim si As IShellItem
    Dim cSMP As StartMenuPin
    
    oleexp.SHCreateItemFromParsingName StrPtr(sItem), Nothing, IID_IShellItem, si
    If (si Is Nothing) = False Then
        Set cSMP = New StartMenuPin
        cSMP.RemoveFromList si
    End If
    End Sub
    EDIT (IMPORTANT):
    I posted the wrong verb. The startpin verb pinned programs to the StartMenu and not the TaskBar. To pin to the TaskBar, use the verb taskbarpin instead. Unpin remains unchanged as it unpins from both. My bad.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2017
    Posts
    366

    Re: VB6 Apps and Windows Task Bar Not Retracting

    thanks for additional input.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2017
    Posts
    366

    Re: VB6 Apps and Windows Task Bar Not Retracting

    Two questions:
    1) Since my App is within its own folder (directory) what CSIDL_constant do I use?
    2) Anyone tried to Pin a App shelled from another App -- or -- must this capability be invoked
    by a separate running program that resides on the desktop (based on article I read) ?
    3) This link:
    https://msdn.microsoft.com/library/w.../bb776911.aspx

    seems to indicate using CSIDL values has been deprecated and "Known Folders" substituted.
    This link addresses question #3.

    http://www.vbforums.com/showthread.p...nownFolderPath

    4) Can a user created Folder of a NON-REGISTERED program (no GUID) be found?
    Last edited by vb6forever; Jan 11th, 2019 at 09:17 PM. Reason: Add question:

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width