Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Legal Dos 8.3 filename in from Windows

Program Source Code

Legal Dos 8.3 filename in from Windows

by  dgrewe  Posted    (Edited  )
*/***************************************************************************
*/Program : GetDos83
*/System : Project Bidding System
*/Purpose : return the dos8.3 filename of a file long file name
*/Syntax : dosname=GetDos83(WinName)
*/Returns : dosname - String - drive:\directory\filename
*/Parameter : WinName - String - drive:\directory\filename (May be blank)
*/Defaults : WinName = ""
*/Requires : path to Windows Win32API.dll
*/Changes : nothing
*/Calls :
*/Version : 1.0
*/Dated : 07/14/2000
*/Written By: John Durbin (From Tek-Tips VFP Forum)
*/ Accepts a path as a parameter.
*/ If the path is invalid or missing then GetFile gets one
*/ If you need a UI interface out of this then remove it
*/***************************************************************************
*& type of prg :
*/***************************************************************************
*/ Record Of Change
*/***************************************************************************
procedure GetDos83
lparameters tcLongPathName
local lcLongFile, lcBuffer, lnBufferSize, lnShortPathLen, lcShortPath
* Validate parameter
if empty(tcLongPathName) or vartype(tcLongPathName) <> 'C' or !file(tcLongPathName)
lcLongFile = getfile()
if !file(lcLongFile)
* user cancelled or again entered invalid stuff
return && Loser!
endif
else
* the path is valid
lcLongFile = tcLongPathName
endif
*
declare integer GetShortPathName in Win32API ;
string @lcLongPath, ;
string @lcShortPathBuff, ;
integer lnBuffSize
* should this be set to the maximum length allowed for a long path name?
lnBufferSize = 511
lcBuffer = space(511)
*
lnShortPathLen = GetShortPathName(lcLongFile, @lcBuffer, @lnBufferSize)
lcShortPath = left(lcBuffer, lnShortPathLen)
return lcShortPath
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top