64 bitne declare funkcije

Pomoč pri izdelavi makrov
Odgovori
Buba
Prispevkov: 85
Pridružen: Sr Mar 12, 2008 11:49 am
Kraj: Maribor

64 bitne declare funkcije

Odgovor Napisal/-a Buba »

Pozdravljeni!
Pred časom sem z vašo pomočjo napisal makro, ki je uporabljal ti dve funkciji:

Koda: Izberi vse

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
Sedaj sem zamenjal računalnik (operacijski sistem je 64 bit.) in makro ne dela. Funkciji sem poizkusil spremeniti takole:

Koda: Izberi vse

Declare Function PtrSafe SHGetPathFromIDList Lib "shell32.dll" _
        Alias "SHGetPathFromIDListA" (ByVal pidl As LongPtr, ByVal pszPath As String) As LongPtr

Declare Function PtrSafe SHBrowseForFolder Lib "shell32.dll" _
        Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As LongPtr
Izvajanje makra se ustavi v vrstici z funkcijo Declare in izpiše opozorilo:
Compile error:
The code in this project must be update for use on 64 bit system. Please review and update Declare statements and then mark them with PtrSafe attribute.

Kako naj popravim makro, da bo delal na 64 bitnem računalniku? :?

Lep dan!
Buba
admin
Site Admin
Prispevkov: 3704
Pridružen: Sr Jul 20, 2005 10:06 pm

Re: 64 bitne declare funkcije

Odgovor Napisal/-a admin »

Pozdravljeni,

Spremenita se deklaraciji obeh funkcij, kakor tudi deklaracija strukture:

Koda: Izberi vse

Private Declare PtrSafe Function SHGetPathFromIDList Lib "shell32.dll" _
        Alias "SHGetPathFromIDListA" (ByVal pidl As LongPtr, ByVal pszPath As String) As Boolean

Private Type BROWSEINFO
    hOwner As LongPtr
    pidlRoot As LongPtr
    pszDisplayName As String
    lpszTitle As String
    ulFlags As Long
    lpfn As LongPtr
    lParam As LongPtr
    iImage As Long
End Type
                        
Private Declare PtrSafe Function SHBrowseForFolder Lib "shell32.dll" 
        Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
lp,
Matjaž Prtenjak
Administrator
Buba
Prispevkov: 85
Pridružen: Sr Mar 12, 2008 11:49 am
Kraj: Maribor

Re: 64 bitne declare funkcije

Odgovor Napisal/-a Buba »

Najlepša hvala!
Deluje! :D
Drugič bom z vprašanjem počakal do ponedeljka!
Lep vikend!
Buba
Odgovori