Red de conocimiento informático - Problemas con los teléfonos móviles - Ayuda de programación de VB, guardar ruta

Ayuda de programación de VB, guardar ruta

Obviamente lo resolví ayer, pero no lo adoptaste

El código es el siguiente, un texto y un comando

Tipo privado BrowseInfo

hWndOwner durante todo el tiempo

pIDLRoot durante todo el tiempo

pszDisplayName durante todo el tiempo

lpszTitle durante todo el tiempo

ulFlags durante tanto tiempo

lpfnCallback As Long

lParam As Long

iImage As Long

Tipo de fin

Const BIF_RETURNONLYFSDIRS = 1

Const MAX_PATH = 260

Sub declaración privada CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)

Función de declaración privada lstrcat Lib "kernel32" Alias ​​​​"lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) Mientras

Función de declaración privada SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) Mientras

Función de declaración privada SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long

Private Sub Command1_Click()

Dim iNull As Integer, lpIDList As Long, lResult As Long

Atenuar sPath como cadena, udtBI como BrowseInfo

Con udtBI

.hWndOwner = Me.hWnd

.lpszTitle = lstrcat("Seleccione un carpeta", "")

.ulFlags = BIF_RETURNONLYFSDIRS

Finalizar con

lpIDList = SHBrowseForFolder(udtBI)

Si lpIDList Entonces

sPath = String$(MAX_PATH, 0)

SHGetPathFromIDList lpIDList, sPath

CoTaskMemFree lpIDList

iNull = InStr(sPath, vbNullChar)

Si es nulo entonces

sPath = Left$(sPath, iNull - 1)

Fin si

Fin si

Text1.Text = sPath

End Sub

Sub privado Form_Load()

Command1.Caption = "Guardar..."

Text1.Text = " "

Es

dSub