Originally Posted by
sjlevine34
Right now, the only App I use with an API call is the one that lists a database's properties and it is coded for both (#IF WIN64 Then...#Else...#End If).
OK, good luck going forward
Just for info, that conditional compilation syntax using #If Win64 isn't usually necessary/appropriate
The following is an example of syntax will work on any version of Access whether 32-bit or 64-bit
Code:
#If VBA7 Then
'add PtrSafe and use LongPtr for pointers/handles
Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr
Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hWnd As LongPtr, ByVal nCmdShow As Long) As Long
#Else
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
#End If
However if all users are running A2010 or later, all will have VBA7 so just the first section is needed without conditional syntax:
Code:
Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr
Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hWnd As LongPtr, ByVal nCmdShow As Long) As Long