Solved

How to find the DOS name of a file?

Posted on 1998-09-20
4
141 Views
Last Modified: 2010-04-30
How do I find the MS-DOS filename of a file?
0
Comment
Question by:Olli083097
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:mcix
ID: 1435754
Could you please clarify your question?
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1435755
Give example please!
0
 
LVL 6

Accepted Solution

by:
clifABB earned 50 total points
ID: 1435756
Add the following code to the declarations section:
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

The Add the following subroutine:
Private Function GetShortName(ByVal sLongFileName As String) As String
  Dim lRetVal As Long
  Dim sShortPathName As String
  Dim nLen As Integer

  'Set up buffer area for API function call return
  sShortPathName = Space(255)
  nLen = Len(sShortPathName)
 
  'Call the function
  lRetVal = GetShortPathName(sLongFileName, sShortPathName, nLen)
  'Strip away unwanted characters.
  GetShortName = Left(sShortPathName, lRetVal)
End Function

You can then call this function passing the long filename and it will return the short filename.
0
 

Author Comment

by:Olli083097
ID: 1435757
Thanx!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question