12-05-13, 12:33 AM
السلام عليكم
- إستخدم هذا الكود لحل مشكلة لإسم الملف وإسم المجلد أو مسار المف أو مسار مجلد الإخراج إن كانت بها مسافات حيث هذا الكود يأتي بالمسار المختصر الخاص بالدوس :
- تحياتي .
- إستخدم هذا الكود لحل مشكلة لإسم الملف وإسم المجلد أو مسار المف أو مسار مجلد الإخراج إن كانت بها مسافات حيث هذا الكود يأتي بالمسار المختصر الخاص بالدوس :
كود :
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long
Private Function GetShortPath(strFileName As String) As String
Dim lngRes As Long, strPath As String
strPath = String$(165, 0)
lngRes = GetShortPathName(strFileName, strPath, 164)
GetShortPath = Left$(strPath, lngRes)
End Function
Private Sub Command1_Click()
Dim File_ShortPath As String
Dim OutPut_ShortPath As String
File_ShortPath = GetShortPath(Trim$(Text1.Text))
OutPut_ShortPath = Trim$(Text2.Text)
If Right$(OutPut_ShortPath, 1) <> "\" Then OutPut_ShortPath = OutPut_ShortPath & "\"
If Dir$(OutPut_ShortPath, vbDirectory) = "" Then
MkDir OutPut_ShortPath
DoEvents
End If
OutPut_ShortPath = GetShortPath(Trim$(OutPut_ShortPath))
Shell "C:\Program Files\WinRAR\WinRAR x " & _
File_ShortPath & _
" *.* " & _
OutPut_ShortPath, vbHide
DoEvents
MsgBox "OK"
End Sub- تحياتي .

