Freigeben über

PtrSafe-Attribut

Anonym
2016-07-12T07:17:55+00:00

Hallo Helfer,

Hallo Helfer,

der u. a. Code funktionierte unter Word 2010 fehlerlos.

Bin nun auf Word 2013 umgestiegen.

Beim Aufruf des Makros erfolgt Hinweis, PtrSafe-Attribut zu verwenden!!????

Bin Einsteiger, komme nicht weiter und bitte um Hilfe.

Vielen Dank.

Gruß

Petert

#If Win64 Then

  ' Anweisungen für x64

    Public Type BROWSEINFO

        hOwner As LongPtr

        pidlRoot As Long

        pszDisplayName As String

        lpszTitle As String

        ulFlags As Long

        lpfn As LongPtr

        lParam As LongPtr

        iImage As Long

    End Type

    Declare PtrSafe Function SHGetPathFromIDList Lib "shell32.dll" _

    Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long

    Declare PtrSafe Function SHBrowseForFolder Lib "shell32.dll" _

    Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long

#Else

   ' Anweisungen für 32 Bit

   Public Type BROWSEINFO

        hOwner As Long

        pidlRoot As Long

        pszDisplayName As String

        lpszTitle As String

        ulFlags As Long

        lpfn As Long

        lParam As Long

        iImage As Long

    End Type

    Declare Function SHGetPathFromIDList Lib "shell32.dll" _

    Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long

    Declare Function SHBrowseForFolder Lib "shell32.dll" _

    Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long

#End If

' ***************************************** Shell

Public Declare Sub Sleep _

    Lib "Kernel32" (ByVal dwMilliseconds As Long)

Public Declare Function GetProcessVersion _

    Lib "Kernel32" (ByVal ProcessId As Long) As Long

' **************************************************

' **************************************************FTP

Private Declare Function WSACleanup Lib "ws2_32.dll" () As Long

 Private Declare Function WSAStartup Lib "ws2_32.dll" (ByVal wVersionRequired As Integer, ByRef lpWSAData As WSAData) As Long

 Private Declare Function socket Lib "ws2_32.dll" (ByVal af As Long, ByVal lType As Long, ByVal protocol As Long) As Long

 Private Declare Sub MoveMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal length As Long)

 Private Declare Function gethostbyname Lib "wsock32.dll" (ByVal Name As String) As Long

 Private Declare Function closesocket Lib "ws2_32.dll" (ByVal s As Long) As Long

 Private Declare Function recv Lib "ws2_32.dll" (ByVal s As Long, ByVal buf As String, ByVal lLen As Long, ByVal flags As Long) As Long

 Private Declare Function send Lib "ws2_32.dll" (ByVal s As Long, ByVal buf As String, ByVal lLen As Long, ByVal flags As Long) As Long

 Private Declare Function connect Lib "ws2_32.dll" (ByVal s As Long, ByRef Name As SOCKADDR, ByVal namelen As Long) As Long

 Private Declare Function inet_addr Lib "wsock32.dll" (ByVal cp As String) As Long

 Private Declare Function htons Lib "wsock32.dll" (ByVal hostshort As Integer) As Integer

 Private Declare Function ioctlsocket Lib "wsock32.dll" (ByVal s As Long, ByVal cmd As Long, argp As Long) As Long

 Private Declare Function KillTimer Lib "user32.dll" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long

 Private Declare Function SetTimer Lib "user32.dll" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long

Microsoft 365 und Office | Word | Für Zuhause | Windows

Gesperrte Frage. Diese Frage wurde aus der Microsoft-Support-Community migriert. Sie können darüber abstimmen, ob sie hilfreich ist, aber Sie können keine Kommentare oder Antworten hinzufügen oder der Frage folgen.

0 Kommentare Keine Kommentare

Antwort, die vom Frageautor angenommen wurde

Anonym
2016-07-12T08:34:46+00:00

Hallo Peter,

du musst alle API-Aufrufe in die #IF-#END IF Verzweigung packen.

Nur die Konstantendeklaration kann außerhalb bleiben, sofern keine speziellen Längen verwendet werden.

War diese Antwort hilfreich?

0 Kommentare Keine Kommentare

1 zusätzliche Antwort

Sortieren nach: Am hilfreichsten
  1. Anonym
    2016-07-12T11:44:31+00:00

    Es funktioniert!!

    Danke.

    Gruß

    Peter

    War diese Antwort hilfreich?

    0 Kommentare Keine Kommentare