From: GS on 2 Feb 2010 21:23 Hi Mike, Thanks! Here's the code: Label1.Caption = App.Path regards, Garry "MikeD" wrote: > > > "GS" <GS(a)discussions.microsoft.com> wrote in message > news:F9DDC05E-1A1C-4F7B-BAF5-9399C73C9089(a)microsoft.com... > > I would like to know if there's a way to force a path string to display > > full > > text instead of the truncated version that uses the tilde character. > > > > i.e.: > > force "C:\Progr~1\My Appli~1\" > > to display as > > "C:\Program Files\My Application\" > > > > Thanks in advance! > > > You're obviously getting short path names. The question is why. Post your > code that is getting this path. Or, use Kevin's example code to obtain the > long names. My point is that it's rare anymore that you'd get the short name > so I'd look into why. For example, if you're getting this from an API > function call, you might be using a old function and should instead be using > a different function. > > -- > Mike > > > > > . >
From: GS on 2 Feb 2010 21:25 Thanks! I'm using the following code, not a control: Label1.Caption = App.Path regards, Garry "Nobody" wrote: > "GS" <GS(a)discussions.microsoft.com> wrote in message > news:F9DDC05E-1A1C-4F7B-BAF5-9399C73C9089(a)microsoft.com... > >I would like to know if there's a way to force a path string to display > >full > > text instead of the truncated version that uses the tilde character. > > > > i.e.: > > force "C:\Progr~1\My Appli~1\" > > to display as > > "C:\Program Files\My Application\" > > What control are you using? > > > . >
From: GS on 2 Feb 2010 21:28 Hi Kevin, Thanks! I'll give this a try. BTW I never went to that school. I'm trying to learn this stuff any which way I can... Help is always appreciated! regards, Garry "C. Kevin Provance" wrote: > > "GS" <GS(a)discussions.microsoft.com> wrote in message > news:F9DDC05E-1A1C-4F7B-BAF5-9399C73C9089(a)microsoft.com... > |I would like to know if there's a way to force a path string to display > full > | text instead of the truncated version that uses the tilde character. > | > | i.e.: > | force "C:\Progr~1\My Appli~1\" > | to display as > | "C:\Program Files\My Application\" > | > > This is kind of old school > > Public Function GetLongFilename(ByVal sShortName As String) As String > > Dim sLongName As String > Dim sTemp As String > Dim iSlashPos As Long > > sShortName = Replace(sShortName, """", vbNullString, 1) > sShortName = sShortName & "\" > > iSlashPos = InStr(4, sShortName, "\") > > While iSlashPos > sTemp = Dir(Left$(sShortName, iSlashPos - 1), vbNormal + vbHidden + > vbSystem + vbDirectory) > If sTemp = vbNullString Then > GetLongFilename = vbNullString > Exit Function > End If > sLongName = sLongName & "\" & sTemp > iSlashPos = InStr(iSlashPos + 1, sShortName, "\") > Wend > > GetLongFilename = Left$(sShortName, 2) & sLongName > > End Function > > > . >
From: GS on 2 Feb 2010 21:33 Thanks Mike! I'll give this a try! What I'm using is: Label1.Caption = App.Path It returns full text on my dev machine (rather short length path) but I get truncated versions on test machines. regards, Garry "Mike Williams" wrote: > "GS" <GS(a)discussions.microsoft.com> wrote in message > news:F9DDC05E-1A1C-4F7B-BAF5-9399C73C9089(a)microsoft.com... > > > I would like to know if there's a way to force a path string > > to display full text instead of the truncated version that uses > > the tilde character. > > You can use the GetLongPathname function: > > Private Declare Function GetLongPathName Lib "kernel32.dll" _ > Alias "GetLongPathNameA" (ByVal lpszShortPath As String, _ > ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long > > Private Function LongPath(ShortPath As String) As String > Dim s1 As String, p As Long > p = GetLongPathName(ShortPath, s1, p) > s1 = Space$(p) > p = GetLongPathName(ShortPath, s1, p) > If p <> 0 Then > LongPath = Left$(s1, p) > End If > End Function > > Mike > > > . >
From: Karl E. Peterson on 2 Feb 2010 22:00
GS explained : > I'm using the following code, not a control: > > Label1.Caption = App.Path You gotta be kidding? What version of VB? What OS? -- ..NET: It's About Trust! http://vfred.mvps.org |