Hide Access Window and show form on startup Windows 7 64Bit

Hudas

Registered User.
Local time
Today, 08:35
Joined
May 13, 2013
Messages
55
Hi -

I research online and found this code, also here in this forum, i can't attach the link becuase its saying that im not allowed until i get 10 post.
Code:
Option Explicit

Private Declare Function GetClassNameA Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal lpClassName As String, _
    ByVal nMaxCount As Long) _
    As Long
Private Declare Function GetWindow Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal wCmd As Long) _
    As Long
Private Declare Function ShowWindowAsync Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal nCmdShow As Long) _
    As Boolean

Private Const GW_HWNDNEXT = 2
Private Const GW_CHILD = 5

Private Const SW_HIDE = 0
Private Const SW_SHOW = 5

Private Function GetClassName( _
    ByVal hwnd As Long) _
    As String

    Dim lpClassName As String
    Dim lLen As Long

    lpClassName = String(255, 32)
    lLen = GetClassNameA(hwnd, lpClassName, 255)
    If lLen > 0 Then
        GetClassName = Left(lpClassName, lLen)
    End If

End Function

Public Sub ShowDbWindow(ByVal bCmdShow As Boolean)

Dim hWndApp As Long

hWndApp = GetWindow(Application.hWndAccessApp, GW_CHILD)
Do Until hWndApp = 0
    If GetClassName(hWndApp) = "MDIClient" Then
        Exit Do
    End If
    hWndApp = GetWindow(hWndApp, GW_HWNDNEXT)
Loop

If hWndApp > 0 Then
    hWndApp = GetWindow(hWndApp, GW_CHILD)
    Do Until hWndApp = 0
        If GetClassName(hWndApp) = "ODb" Then
            Exit Do
        End If
        hWndApp = GetWindow(hWndApp, GW_HWNDNEXT)
    Loop
End If

If hWndApp > 0 Then
    ShowWindowAsync hWndApp, IIf(bCmdShow, SW_SHOW, SW_HIDE)
End If

End Sub

Code:
ShowDbWindow False

Code:
ShowDbWindow True
but the problem is I am having an Compile error: The code in this project must be updated on 64bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute.

Can someone please help me. If this code cannot be remedied can you please point me to where I can find the solution to what I want.

Thank you
Hudas
 
This means that the declaration should be like the following
Code:
Private Declare PtrSafe Function ..........
 

Users who are viewing this thread

Back
Top Bottom