dcsimg
Results 1 to 4 of 4

Thread: [RESOLVED] VBA.Shell ( .... vbMinimizedNoFocus) is not working

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2017
    Posts
    67

    Resolved [RESOLVED] VBA.Shell ( .... vbMinimizedNoFocus) is not working

    https://i.imgur.com/OKAJnMG.jpg


    Excuse me
    Is there a solution?

    This problem bothers me

    other app is running I lose focus on the first app
    Attached Images Attached Images  
    Attached Files Attached Files
    • File Type: zip 1.zip (6.7 KB, 9 views)
    Last edited by quickbbbb; Sep 10th, 2019 at 04:26 AM.

  2. #2
    Addicted Member
    Join Date
    Aug 2017
    Posts
    201

    Re: VBA.Shell ( .... vbMinimizedNoFocus) is not working

    Try this set the Startup Object in your Project Properties to Sub Main, add a standard (.BAS) module to your project (if there isn't one already) and paste the following:

    Code:
    Option Explicit     'In a standard (.BAS) module
    
    Private Const GW_OWNER       As Long = 4
    Private Const SW_HIDE        As Long = 0
    Private Const SW_SHOWDEFAULT As Long = 10
    
    Private Declare Function EnumThreadWindows Lib "user32.dll" (ByVal dwThreadId As Long, ByVal lpfn As Long, ByVal lParam As Long) As Long
    Private Declare Function GetClassNameW Lib "user32.dll" (ByVal hWnd As Long, ByVal lpClassName As Long, ByVal nMaxCount As Long) As Long
    Private Declare Function GetWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal uCmd As Long) As Long
    Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
    Private Declare Function SysReAllocStringLen Lib "oleaut32.dll" (ByVal pBSTR As Long, Optional ByVal pszStrPtr As Long, Optional ByVal Length As Long) As Long
    
    Private Sub Main()
        With New Form1
            EnumThreadWindows App.ThreadID, AddressOf EnumThreadWndProc, GetWindow(.hWnd, GW_OWNER)
            ShowWindow .hWnd, SW_SHOWDEFAULT
        End With
    End Sub
    
    Private Function EnumThreadWndProc(ByVal hWnd As Long, ByVal ThunderMainhWnd As Long) As Long
        Const MAX_CLASS_NAME = 256&
        Dim sClassName As String
    
        SysReAllocStringLen VarPtr(sClassName), , MAX_CLASS_NAME
        SysReAllocStringLen VarPtr(sClassName), StrPtr(sClassName), _
        GetClassNameW(hWnd, StrPtr(sClassName), MAX_CLASS_NAME + 1&)
    
        If sClassName = "Static" Then
            If GetWindow(hWnd, GW_OWNER) = ThunderMainhWnd Then
                ShowWindow hWnd, SW_HIDE
                ShowWindow ThunderMainhWnd, SW_HIDE
                Exit Function
            End If
        End If
    
        EnumThreadWndProc = -True
    End Function

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2017
    Posts
    67

    Re: VBA.Shell ( .... vbMinimizedNoFocus) is not working

    thank you very much

    it work very fine

    thank you

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2017
    Posts
    67

    Re: VBA.Shell ( .... vbMinimizedNoFocus) is not working

    .......

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