[AccessD] 32->64 bit

Borge Hansen pcs.accessd at gmail.com
Thu Nov 4 22:23:01 CDT 2021


Arthur,
You and your client are probably not going to run your app in a
version of Access prior to Access 2010.
I would cut out the conditional compilation statement
#If VBA7 Then
#Else
#End If

and just search and replace the Lib "user32" statement with the new
LongPtr using the file I sent a link to previously.
In your startup code - just to be sure - you can test for VBA7 and
graciously close the app if it's running on a pre Access2010 version.
That's what I did.
I also have a lot of API calls from Gets and Litwin's  handbook and I
recommend you keep the Private scope for those API calls.
I did the upgrade on a 32bit version of Access running Windows 64bit
and tested on another Windows64 machine running a 64bit version of
Access.
In the file - that I sent a link to:
https://docs.microsoft.com/en-us/office/troubleshoot/office-suite-issues/win32api_ptrsafe-with-64-bit-support
there are a few API calls where they test for Win64 - I'd copy that
across, just in case you have a client running a 32bit version of
Access 2010 or later on a 32bit version of Windows...
An example (from the Getz, Litwin FormInfo class module) would be:
++++#If Win64 Then
Private Declare PtrSafe Function GetWindowLongPtr Lib "user32" Alias
"GetWindowLongPtrA" (ByVal hWnd As LongPtr, ByVal nIndex As Long) As
LongPtr
Private Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias
"SetWindowLongPtrA" (ByVal hWnd As LongPtr, ByVal nIndex As Long,
ByVal dwNewLong As LongPtr) As LongPtr
#Else
Private Declare PtrSafe Function GetWindowLongPtr Lib "user32" Alias
"GetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long) As
LongPtr
Private Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias
"SetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal
dwNewLong As LongPtr) As LongPtr
#End If
+++++

Good luck with the conversion,
/borge






On Fri, Nov 5, 2021 at 12:38 AM Arthur Fuller <fuller.artful at gmail.com> wrote:
>
> This is more work than I had hoped. Also confusing. A bunch of the code I'm
> trying to upgrade comes frm Access 2000 Developers Handbook (Getz, Liwin
> et. a.) All the code I gpt from there declares the API stuff like this:
>
> Private Declare Function xyz
>
> I don't understand the use of "Private" in this context.
>
> the Win32API_PtrSafe.txt file doesn't use the Private word. Instead the
> declarations look like this:
>
>  #If VBA7 Then
>   Declare PtrSafe Function SetTimer Lib "user32" (ByVal hWnd As LongPtr,
> ByVal nIDEvent As LongPtr, ByVal uElapse As Long, ByVal lpTimerFunc As
> LongPtr) As LongPtr
> #Else
>   Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal
> nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
> #End If
>
> --
> Arthur
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


More information about the AccessD mailing list