Anzeige
Archiv - Navigation
1908to1912
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

32 bit auf 64 bit umschreiben

32 bit auf 64 bit umschreiben
05.12.2022 11:02:55
Dogan
Hallo liebe Community,
ich habe mit der hilfe hier im Forum, eine, für mich sehr umfangreiche VBA erstellt und müsste diese aus der 32bit Version in eine 64bit Version umschreiben. Ist das jetzt eher ein "Übersetzen" oder eher eine neue Programmierung die man vornehmen muss?
Z.B. habe ich folgendes in der VBA stehen die in der 64 bit Version nicht mehr funktioniert:
Private Declare Function SHGetFileInfo Lib "Shell32" Alias "SHGetFileInfoA" (ByVal pszPath _
As Any, ByVal dwFileAttributes As Long, psfi As SHFILEINFO, ByVal cbFileInfo As Long, _
ByVal uFlags As Long) As Long

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: 32 bit auf 64 bit umschreiben
05.12.2022 11:22:05
Rudi
Hallo,

#If VBA7 Then
Private Declare PtrSafe Function SHGetFileInfo Lib "Shell32" Alias "SHGetFileInfoA" (ByVal pszPath _
As Any, ByVal dwFileAttributes As Long, psfi As SHFILEINFO, ByVal cbFileInfo As Long, _
ByVal uFlags As Long) As LongPtr
#Else
Private Declare Function SHGetFileInfo Lib "Shell32" Alias "SHGetFileInfoA" (ByVal pszPath _
As Any, ByVal dwFileAttributes As Long, psfi As SHFILEINFO, ByVal cbFileInfo As Long, _
ByVal uFlags As Long) As Long
#End If
sollte gehen.
Gruß
Rudi
AW: 32 bit auf 64 bit umschreiben
05.12.2022 13:45:03
Dogan
Ok. Bleibt dort nicht mehr hängen.
Kann ich bei der nächste Meldung folgendes tun?
Das ganze:
Private Declare Function FindFirstFile Lib "kernel32.dll" Alias "FindFirstFileA" (ByVal _
lpFileName As String, ByRef lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFile Lib "kernel32.dll" Alias "FindNextFileA" (ByVal _
hFindFile As Long, ByRef lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindClose Lib "kernel32.dll" (ByVal hFindFile As Long) As Long
Private Declare Function FileTimeToLocalFileTime Lib "kernel32.dll" (ByRef lpFileTime As _
FILETIME, ByRef lpLocalFileTime As FILETIME) As Long
Private Declare Function FileTimeToSystemTime Lib "kernel32.dll" (ByRef lpFileTime As _
FILETIME, ByRef lpSystemTime As SYSTEMTIME) As Long
Als:
#If VBA7 Then
Private Declare PtrSafe Function FindFirstFile Lib "kernel32.dll" Alias "FindFirstFileA" (ByVal _
lpFileName As String, ByRef lpFindFileData As WIN32_FIND_DATA) As LongPtr
Private Declare PtrSafe Function FindNextFile Lib "kernel32.dll" Alias "FindNextFileA" (ByVal _
hFindFile As Long, ByRef lpFindFileData As WIN32_FIND_DATA) As LongPtr
Private Declare PtrSafe Function FindClose Lib "kernel32.dll" (ByVal hFindFile As Long) As LongPtr
Private Declare PtrSafe Function FileTimeToLocalFileTime Lib "kernel32.dll" (ByRef lpFileTime As _
FILETIME, ByRef lpLocalFileTime As FILETIME) As LongPtr
Private Declare PtrSafe Function FileTimeToSystemTime Lib "kernel32.dll" (ByRef lpFileTime As _
FILETIME, ByRef lpSystemTime As SYSTEMTIME) As LongPtr
#Else
Private Declare Function FindFirstFile Lib "kernel32.dll" Alias "FindFirstFileA" (ByVal _
lpFileName As String, ByRef lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFile Lib "kernel32.dll" Alias "FindNextFileA" (ByVal _
hFindFile As Long, ByRef lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindClose Lib "kernel32.dll" (ByVal hFindFile As Long) As Long
Private Declare Function FileTimeToLocalFileTime Lib "kernel32.dll" (ByRef lpFileTime As _
FILETIME, ByRef lpLocalFileTime As FILETIME) As Long
Private Declare Function FileTimeToSystemTime Lib "kernel32.dll" (ByRef lpFileTime As _
FILETIME, ByRef lpSystemTime As SYSTEMTIME) As Long
#End If
Anzeige
AW: 32 bit auf 64 bit umschreiben
05.12.2022 13:54:15
Nepumuk
Hallo Dogan,
so:

#If Win64 Then
Private Declare PtrSafe Function FindFirstFileA Lib "kernel32.dll" ( _
ByVal lpFileName As String, _
ByRef lpFindFileData As WIN32_FIND_DATA) As LongPtr
Private Declare PtrSafe Function FindNextFileA Lib "kernel32.dll" ( _
ByVal hFindFile As LongPtr, _
ByRef lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare PtrSafe Function FindClose Lib "kernel32.dll" ( _
ByVal hFindFile As LongPtr) As Long
Private Declare PtrSafe Function FileTimeToLocalFileTime Lib "kernel32.dll" ( _
ByRef lpFileTime As FILETIME, _
ByRef lpLocalFileTime As FILETIME) As Long
Private Declare PtrSafe Function FileTimeToSystemTime Lib "kernel32.dll" ( _
ByRef lpFileTime As FILETIME, _
ByRef lpSystemTime As SYSTEMTIME) As Long
#Else
Private Declare Function FileTimeToLocalFileTime Lib "kernel32.dll" ( _
ByRef lpFileTime As FILETIME, _
ByRef lpLocalFileTime As FILETIME) As Long
Private Declare Function FileTimeToSystemTime Lib "kernel32.dll" ( _
ByRef lpFileTime As FILETIME, _
ByRef lpSystemTime As SYSTEMTIME) As Long
Private Declare Function FindClose Lib "kernel32.dll" ( _
ByVal hFindFile As Long) As Long
Private Declare Function FindFirstFileA Lib "kernel32.dll" ( _
ByVal lpFileName As String, _
ByRef lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFileA Lib "kernel32.dll" ( _
ByVal hFindFile As Long, _
ByRef lpFindFileData As WIN32_FIND_DATA) As Long
#End If

#If Win64 Then
Private Const INVALID_HANDLE_VALUE As LongPtr = -1
#Else
Private Const INVALID_HANDLE_VALUE As Long = -1&
#End If

Private Sub FindFiles(ByVal pvstrFolderPath As String)
#If Win64 Then
Dim lngSearch As LongPtr
#Else
Dim lngSearch As Long
#End If
...

Private Sub GetFilesInFolder(ByVal pvstrFolderPath As String)
#If Win64 Then
Dim lngSearch As LongPtr
#Else
Dim lngSearch As Long
#End If
...
Gruß
Nepumuk
Anzeige
AW: 32 bit auf 64 bit umschreiben
05.12.2022 14:57:44
Dogan
Hallo Nepumuk,
ich bedanke mich recht herzlich...
AW: 32 bit auf 64 bit umschreiben
05.12.2022 11:24:56
Nepumuk
Hallo Dogan,
so:

Option Explicit
Private Declare PtrSafe Function SHGetFileInfo Lib "shell32.dll" Alias "SHGetFileInfoA" ( _
ByVal pszPath As String, _
ByVal dwFileAttributes As Long, _
ByRef psfi As SHFILEINFO, _
ByVal cbFileInfo As Long, _
ByVal uFlags As Long) As LongPtr
Private Const MAX_PATH As Long = 260
Private Type SHFILEINFO
hIcon As LongPtr
iIcon As Long
dwAttributes As Long
szDisplayName(0 To MAX_PATH - 1) As Byte
szTypeName(0 To 79) As Byte
End Type
Gruß
Nepumuk

238 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige