Long Filename Problem with FileListBox

I am using a FileListBox in an app and I am having a problem with long filenames on a Novell Network.  Sometimes the FileListBox will not see the long filename on the network server but will display the short filename instead.  Windows Explorer will see the file just fine.  Not completley sure if this is a netware issue or a VB issue.  I am leaning toward a VB issue because it is the only thing I am having the problem with.  Every other app can see the long filename with no problem.  I am using VB 6.0 Service Pack 2.0
clarsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nutwissCommented:
I believe it is a NetWare issue.
0
watyCommented:
Try this?

' #VBIDEUtils#************************************************************
' * Programmer Name  : Waty Thierry
' * Web Site         : www.geocities.com/ResearchTriangle/6311/
' * E-Mail           : waty.thierry@usa.net
' * Date             : 28/06/99
' * Time             : 13:04
' **********************************************************************
' * Comments         : Retrieve the long name path from short name path
' *
' *
' **********************************************************************

Public Function GetLongPathName(ByVal sShortName As String) As String
   Dim sLongName    As String
   Dim sTemp        As String
   Dim iSlashPos    As Integer

   If Len(sShortName) < 1 Then Exit Function
   If Right$(sShortName, 1) = "\" Then
      sShortName = Left$(sShortName, Len(sShortName) - 1)
   End If
   ' Add  to short name to prevent Instr from failing
   sShortName = sShortName & "\"
   ' Start from 4 to ignore the "[Drive Letter]:" characters
   iSlashPos = InStr(4, sShortName, "\")
   ' Pull out each string between  character for conversion
   While iSlashPos
      sTemp = Dir(Left$(sShortName, iSlashPos - 1), _
         vbNormal + vbHidden + vbSystem + vbDirectory)
      If sTemp = "" Then    ' Error 52 - Bad File Name or Number
         GetLongPathName = ""
         Exit Function
      End If
      sLongName = sLongName & "\" & sTemp
      iSlashPos = InStr(iSlashPos + 1, sShortName, "\")
   Wend
   ' Prefix with the drive letter
   GetLongPathName = Left$(sShortName, 2) & sLongName
End Function

Private Sub Command1_Click()
   MsgBox GetLongPathName("c:\window~1\")
End Sub

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AnswerTheManCommented:
hmmm... whenever i need to display DIRs and FILES in my apps - i use an OCX that imitates exactly WindowsExplorer, instaed of the ugly fileListBox.
if you want that OCX - paste your email and i'll be sending it within 24 hours or so.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

clarsonAuthor Commented:
AnswerTheMan,
My email is clarson@burnsmcd.com
Is this OCX freeware?  If so I would be interested in looking at it.
Thanks

Waty,
I thought about that, but it doesn't prove to be the best solution for this application.
Thanks for the input.
0
AnswerTheManCommented:
yeah. it's free and i've also distributed it succesfuly to other machins.
just sent it.
0
nutwissCommented:
>I am using VB 6.0 Service Pack 2.0

I'd recommend sp3 ASAP. (not for this prob, but just because there are a few issues with sp2)
0
clarsonAuthor Commented:
AnswerTheMan,
well, I already had that one, but thanks for sending it anyhow.
0
AnswerTheManCommented:
so, why are you using the fileListBox ?
0
SiM99Commented:
I'm sure there are API functions to convert long path names into shor path names and vice versa...

If i come accross the functions on MSDN i will post the page URLS

0
SiM99Commented:
HOWTO: Get a Short Filename from a Long Filename
http://support.microsoft.com/support/kb/articles/Q175/5/12.ASP

HOWTO: Get a Long Filename from a Short Filename
http://support.microsoft.com/support/kb/articles/Q154/8/22.ASP
0
clarsonAuthor Commented:
Waty already suggested doing that, but it will not work for the application.  The problem is the user is looking for one filename and cannot find it.  The short filename on Netware does not consist of a file~1.ext like on 95 or NT so it makes things confusing because the user does know which file is the one they want.  142e00002A-Layout1.plt might have 142e0002.plt as a short filename.  If they have a file name 142e0001.plt in the directory the filelistbox would show 142e0001.plt and 142e0002.plt.  When you have 50+ files in a directory that look this way it gets very difficult to find the one you are looking for.
0
clarsonAuthor Commented:
A filelistbox was being used because it is an older app that has been updated for several years.  It looks like it is time to rewrite it.
0
clarsonAuthor Commented:
I have decided to rewrite with an explorer like interface.  The question I have is what to I do with my question.  It was never answered and I have given up on the filelistbox issue now.  Any suggestions?
0
SiM99Commented:
Ask another question here, and get us to answer that one ? :)

Or change the points to 0, and then accept an answer
0
clarsonAuthor Commented:
Since my question is has not been answered and I have given up on the FileListBox i am going to decrease the points and accept one of the comments as the answer.
0
clarsonAuthor Commented:
Well I guess it won't let me lower the points. So much for that.
0
clarsonAuthor Commented:
Well my question was never answered, but since waty posted some code that I may find usefull someday I am going to give him the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.