32-64 Bit Problem
02.02.2013 12:17:00
Albert
ich bringe das folgende Makro unter der 64 Bit Version von Office 10 nicht zum Laufen. (In der 32 Bit Version funktionierte es problemlos)
Option Explicit
#If Win64 Then
Private Declare PtrSafe Function SetTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc _
As Long) As Long
Private Declare PtrSafe Function KillTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private Declare PtrSafe Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function GetWindow Lib "user32" _
(ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare PtrSafe Function GetClassName Lib "user32" _
Alias "GetClassNameA" (ByVal hwnd As Long, ByVal _
lpClassName As String, ByVal nMaxCount As Long) _
As Long
Private Declare PtrSafe Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, ByVal cch As Long) _
As Long
Private Declare PtrSafe Function SendMessageBynum& Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, ByVal _
wMsg As Long, ByVal wParam As Long, ByVal lParam _
As Long)
#Else
Private Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc _
As Long) As Long
Private Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetWindow Lib "user32" _
(ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetClassName Lib "user32" _
Alias "GetClassNameA" (ByVal hwnd As Long, ByVal _
lpClassName As String, ByVal nMaxCount As Long) _
As Long
Private Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, ByVal cch As Long) _
As Long
Private Declare Function SendMessageBynum& Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, ByVal _
wMsg As Long, ByVal wParam As Long, ByVal lParam _
As Long)
#End If
#If VBA7 Then
Private iPasswortchar As LongPtr
Private hlngTimerKennung As LongPtr
Private iTitel As String
Private Const EM_SETPASSWORDCHAR = &HCC
Private Const GW_CHILD = 5
Private Const GW_HWNDFIRST = 0
Private Const GW_HWNDNEXT = 2
#Else
Private iPasswortchar As Long
Private hlngTimerKennung As Long
Private iTitel As String
Private Const EM_SETPASSWORDCHAR = &HCC
Private Const GW_CHILD = 5
Private Const GW_HWNDFIRST = 0
Private Const GW_HWNDNEXT = 2
#End If
Private Sub TimerSetzen()
hlngTimerKennung = SetTimer(0, 0, 200, AddressOf ApiTimer)
If hlngTimerKennung = 0 Then MsgBox _
"Fehler beim Initialisieren des Timers"
End Sub
Die Fehlermeldung kommt bei "AddressOf ApiTimer" und lautet folgendermassen:Fehler beim Kompilieren
Typen unverträglich
Ich bitte um Unterstützung und bedanke mich im Vorhinein
Albert