Bonjour,
ci-dessous un exemple pour rendre compatible un code entre le 32 et 64 bits !
' ici deux déclarations de bibliothèques afin d'être compatible 32bits et 64bits
#If VBA7 Then
Public Declare PtrSafe Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Public Declare PtrSafe Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long) As Long
Public Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
#Else
Public Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long) As Long
Public Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
#End If
le IF VBA7 détecte le 64 bits, alors les function "32" sont initialisées avec le PtrSafe
Si cela ne suffit pas il faut peut-être aussi définir les variables "Long" en "PtrLong", mais comme sur l'exemple ce n'est pas forcément utile :
Public Declare PtrSafe Function GetDC Lib "user32" (ByVal hWnd As PtrLong) As Long
@ bientôt
LouReeD