![]() |
(SST) ShlWAPI.pas Version 1.08 |
---|---|
Developer Reference |
Returns the drive number corresponding to the drive letter of the root path. |
Scope |
---|
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas). |
Parameters | |
---|---|
pszPath [in] | A pointer to the zero-terminated path string of which the root path's drive letter (if present) and corresponding drive number are to be determined. |
Return Values |
---|
Returns 0 for the drive letter A, 1, for drive letter B, and so on, up to and including 25 for drive letter Z. If the path string (pszPath) is not a fully qualified path (i.e. one that begins with a drive letter), the function returns -1. |
Remarks |
---|
The function apparently verifies neither the existence of the path, nor the drive. |
Example |
---|
PROCEDURE TForm4.TestShlWAPIPathGetDriveNumber(Sender : TObject); VAR srcpath : STRING; VAR apiretval : INTEGER; VAR newinfoline : STRING; BEGIN srcpath := ''; apiretval := 0; newinfoline := ''; srcpath := 'C:\Windows'; apiretval := PathGetDriveNumber(PChar(srcpath)); newinfoline := 'PathGetDriveNumber called with parameter ' + srcpath + ' returned : ' + IntToStr(apiretval); Memo1.Lines.Add(newinfoline); newinfoline := ''; srcpath := 'X:\NonExistentDir\NonExistentSubDir'; apiretval := PathGetDriveNumber(PChar(srcpath)); newinfoline := 'PathGetDriveNumber called with parameter ' + srcpath + ' returned : ' + IntToStr(apiretval); Memo1.Lines.Add(newinfoline); Memo1.Lines.Add(''); END; |
Under Windows Vista the above example produces the following output: |
PathGetDriveNumber called with parameter C:\Windows returned : 2 PathGetDriveNumber called with parameter X:\NonExistentDir\NonExistentSubDir returned : 23 |
Requirements | |
---|---|
Unit: | Declared and imported in (SST)ShlWAPI.pas |
Library: | (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj |
Unicode: | Implemented as ANSI (PathGetDriveNumber and PathGetDriveNumberA) and Unicode (PathGetDriveNumberW) functions. |
Min. ShlWAPI.dll version according to MS SDK doc.: | 4.71 |
Min. ShlWAPI.dll version based on SST research: | 4.71 |
Min. OS version(s) according to Microsoft SDK doc.: | Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0 |
Min. OS version(s) according to SST research.: | Windows NT 4.0 with IE 4.0, Windows 95 with IE 4.0, Windows 98, Windows 2000 and later |
See Also |
---|
PathBuildRoot |
Windows APIs: PathGetDriveNumber, PathBuildRoot, GetLogicalDriveStrings, GetLogicalDrives |
Document/Contents version 1.00 Page/URI last updated on May 04, 2022 |
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017 |
Suggestions and comments mail to: webmaster@stoelzelsoftwaretech.com |