isladogs
MVP / VIP
- Local time
- Today, 11:43
- Joined
- Jan 14, 2017
- Messages
- 18,624
Just one BIG caveat to that advice.
APIs adapted to work in 64-bit Access will also run in 32-bit Office from A2010 onwards (VBA7)
For example, below I'm using conditional compilation so these 2 APIs will work in all versions and bitnesses:
But unless you also need to cater for users with A2007 or earlier there is no need to worry about conditional compilation so you just need this:
In most cases, conversion isn't that difficult but its tedious and can be time consumimng.
So, if I were you, I would start converting your projects to work in both bitnesses as & when you have time to do so.
Look at example apps that have been converted.
For example, all of mine are supplied with conditional compilation
At some point, you will indeed have to deal with the situation.
Better to be prepared in advance rather than face the situation I had in 2014 of having to convert several huge applications in a two week timeframe ...when I really didn't know what I was doing
APIs adapted to work in 64-bit Access will also run in 32-bit Office from A2010 onwards (VBA7)
For example, below I'm using conditional compilation so these 2 APIs will work in all versions and bitnesses:
Code:
'###############################################
'Updated by Colin Riddington - 26/01/2019
#If VBA7 Then 'A2010 or later (32/64-bit)
Private Declare PtrSafe Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function SetWindowPos Lib "user32" _
(ByVal handleW1 As LongPtr, ByVal handleW1InsertWhere As LongPtr, ByVal w As Long, _
ByVal X As Long, ByVal Y As Long, ByVal z As Long, ByVal wFlags As Long) As Long
#Else 'A2007 or earlier (32-bit)
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" _
(ByVal handleW1 As Long, ByVal handleW1InsertWhere As Long, ByVal w As Long, _
ByVal X As Long, ByVal Y As Long, ByVal z As Long, ByVal wFlags As Long) As Long
#End If
'###############################################
But unless you also need to cater for users with A2007 or earlier there is no need to worry about conditional compilation so you just need this:
Code:
'###############################################
Private Declare PtrSafe Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function SetWindowPos Lib "user32" _
(ByVal handleW1 As LongPtr, ByVal handleW1InsertWhere As LongPtr, ByVal w As Long, _
ByVal X As Long, ByVal Y As Long, ByVal z As Long, ByVal wFlags As Long) As Long
'###############################################
In most cases, conversion isn't that difficult but its tedious and can be time consumimng.
So, if I were you, I would start converting your projects to work in both bitnesses as & when you have time to do so.
Look at example apps that have been converted.
For example, all of mine are supplied with conditional compilation
At some point, you will indeed have to deal with the situation.
Better to be prepared in advance rather than face the situation I had in 2014 of having to convert several huge applications in a two week timeframe ...when I really didn't know what I was doing