Using Win32 functions in Visual FoxPro Image Gallery
Shell Lightweight Utility APIs -- Path Functions
..msdn
PathBuildRoot
PathCombine
PathCompactPathEx
PathFileExists
PathFindExtension
PathFindFileName
PathFindOnPath
PathGetDriveNumber
PathGetShortPath
PathIsDirectory
PathIsNetworkPath
PathIsRelative
PathIsRoot
PathIsURL
PathRenameExtension
PathSearchAndQualify
UrlEscape
UrlGetPart
UrlHash
UrlUnescape
Code examples:
Using Path functions from Shell Lightweight Utility APIs (shlapi.dll)
Using Path functions from Shell Lightweight Utility APIs (shlapi.dll)

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
DO decl

LOCAL lcComponent, lcFullPath, lnPointer
lcFullPath = "C:\Program Files\Microsoft Office\Office\Binder.exe" 

? "Source path string:", lcFullPath

? "File exists:", Iif(PathFileExists(lcFullPath)=0, "No","Yes")
? "Path is directory:", Iif(PathIsDirectory(lcFullPath)=0, "No","Yes")

* e.g. "prgs\tx0.prg"
? "Path is relative:", Iif(PathIsRelative(lcFullPath)=0, "No", "Yes")

* e.g. "C:\"
? "Path is root:", Iif(PathIsRoot(lcFullPath)=0, "No", "Yes")

* e.g. "http://www.news2news.com/vfp/downloads/" 
? "Path is URL:", Iif(PathIsURL(lcFullPath)=0, "No", "Yes")

* any mapped network drive, or a network name like "\\prnserver"
? "A network resource:", Iif(PathIsNetworkPath(lcFullPath)=0, "No","Yes")

? "File name:", PathFindFileName(lcFullPath)
? "File extension:", PathFindExtension(lcFullPath)

lcComponent = lcFullPath
= PathRenameExtension (@lcComponent, ".inf")
? "With extension replaced:", lcComponent

* Returns 0 through 25 (corresponding to "A" through "Z") 
* if the path has a drive letter, or -1 otherwise
? "Drive number:", PathGetDriveNumber(lcFullPath)

? "Root directories: "
FOR ii=0 TO 25
    lcComponent = SPACE(250)
    IF PathBuildRoot(@lcComponent, ii) <> 0
        ?? Left(lcComponent, AT(Chr(0), lcComponent)-1)+" "
    ENDIF
ENDFOR

PROCEDURE  decl
    DECLARE STRING  PathFindFileName IN shlwapi STRING pPath
    DECLARE INTEGER PathFileExists IN shlwapi STRING pszPath
    DECLARE INTEGER PathIsDirectory IN shlwapi STRING pszPath
    DECLARE INTEGER PathIsRelative IN shlwapi STRING pszPath
    DECLARE INTEGER PathIsRoot IN shlwapi STRING pszPath
    DECLARE INTEGER PathIsURL IN shlwapi STRING pszPath
    DECLARE INTEGER PathIsNetworkPath IN shlwapi STRING pszPath
    DECLARE STRING  PathFindExtension IN shlwapi STRING pPath
    DECLARE INTEGER PathGetDriveNumber IN shlwapi STRING lpsz

    DECLARE INTEGER PathRenameExtension IN shlwapi;
        STRING @pszPath, STRING pszExt

    DECLARE INTEGER PathBuildRoot IN shlwapi;
        STRING @szRoot, INTEGER iDrive


User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2008 bytes  
Created: 2001-10-29 18:53:16  
Modified: 2005-02-25 18:16:36  
Visits in 7 days: 253  
Listed functions:
PathBuildRoot
PathFileExists
PathFindExtension
PathFindFileName
PathGetDriveNumber
PathIsDirectory
PathIsNetworkPath
PathIsRelative
PathIsRoot
PathIsURL
PathRenameExtension
Printer friendly API declarations
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2018 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (23.22.240.119)
6 sec.Example: 'How to make a VFP form fading out when released (GDI version)'
21 sec.Function: 'PathIsNetworkPath'
Function group: 'Shell Lightweight Utility APIs -- Path Functions'
26 sec.Examples
35 sec.Example: 'Obtaining names and positions for shortcuts located on the Windows Desktop'
42 sec.Example: 'How to put a vertical text scrolling on the form (a movie cast)'
50 sec.Function: 'InternetGoOnline'
Function group: 'Internet Functions (WinInet)'
56 sec.Updates
1.07 min.Function: 'JetGetColumnInfo'
Function group: 'Extensible Storage Engine (ESE, Jet Blue)'
1.18 min.Function: 'PathFindFileName'
Function group: 'Shell Lightweight Utility APIs -- Path Functions'
1.55 min.Function: 'midiOutGetDevCaps'
Google
Advertise here!