?
Solved

How to find the DOS name of a file?

Posted on 1998-09-20
4
Medium Priority
?
142 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 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month15 days, left to enroll

771 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