Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to find the DOS name of a file?

Posted on 1998-09-20
4
Medium Priority
?
144 Views
Last Modified: 2010-04-30
How do I find the MS-DOS filename of a file?
0
Comment
Question by:Olli083097
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 200 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

877 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