home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Convert a Long Path Name to a Short Path Name"
- ClientHeight = 3690
- ClientLeft = 4305
- ClientTop = 2190
- ClientWidth = 5160
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3690
- ScaleWidth = 5160
- StartUpPosition = 2 'CenterScreen
- Begin VB.DirListBox Dir1
- Height = 1440
- Left = 120
- TabIndex = 4
- Top = 480
- Width = 4935
- End
- Begin VB.CommandButton cmdQuit
- Caption = "&Quit"
- Height = 375
- Left = 2040
- TabIndex = 0
- Top = 3240
- Width = 975
- End
- Begin VB.Label Label3
- Caption = "Click a folder to see the long and short path names."
- Height = 255
- Left = 120
- TabIndex = 6
- Top = 240
- Width = 3855
- End
- Begin VB.Label lblLong
- BackColor = &H00FFFFFF&
- BorderStyle = 1 'Fixed Single
- Height = 255
- Left = 120
- TabIndex = 5
- Top = 2280
- Width = 4935
- End
- Begin VB.Label lblShort
- BackColor = &H00FFFFFF&
- BorderStyle = 1 'Fixed Single
- Height = 255
- Left = 120
- TabIndex = 3
- Top = 2880
- Width = 4935
- End
- Begin VB.Label Label2
- Caption = "Short Path:"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 2640
- Width = 855
- End
- Begin VB.Label Label1
- Caption = "Long Path:"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 2040
- Width = 975
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmdQuit_Click()
- Unload Me
- End Sub
- Private Sub Dir1_Click()
- Dim sLongPath As String
- Dim sShortPath As String
- Dim lPathLen As Long
- Dim lLen As Long
- Const MAX_PATH = 260
- lblLong = Dir1.List(Dir1.ListIndex)
- sShortPath = Space$(MAX_PATH)
- lLen = Len(sShortPath)
- lPathLen = GetShortPathName(lblLong.Caption, sShortPath, lLen)
- lblShort.Caption = Left$(sShortPath, lPathLen)
- End Sub
-