Forumbeitrag
Excel-Version des Fragestellers:
2010
Erfahrungslevel des Fragestellers:
Basiskenntnisse in VBA
Hallo Uwe und Case,
m.E. sollte man für Set/GetWindowlong
immer den 32/64 Bit-Schalter einsetzen.
Wo ist das Problem. Das hat auch mit altem Excel (VBA6) nichts zu tun, denn hier geht es nur um die Entscheidung 32/64 Bit im VBA7. Der Code an sich kann ja gleich bleiben.
Wie man in den Foren sieht, sind sehr viele mit 32Bit-Excel unterwegs.
#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
Mit Casens Lösung wäre der TE sicher glücklich geworden. Funktioniert ja tadellos.
Gruß KH