![]() |
(SST) ShlWAPI.pas Version 1.08 |
---|---|
Developer Reference |
Compares the suffix of a folder or file in a path string to the strings in an array of suffixes. |
Scope |
---|
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas). |
Syntax | |
---|---|
![]() |
function PathFindSuffixArray(pszPath : LPCSTR; apszSuffix : LPCSTR; iArraySize : Integer) : LPCSTR; |
Parameters | |
---|---|
pszPath [in] | A pointer to the zero-terminated path string with the suffix to compare to the suffixes listed in the array. |
apszSuffix [in] | A pointer to the array of suffixes to which to compare the path's suffix. |
iArraySize [in] | The number of strings in the array of suffixes to which the path's suffix is compared. |
Return Values |
---|
Returns a pointer to the suffix in the array that is identical to the suffix in the path (pszPath). |
Remarks |
---|
The comparison is case-sensitive. |
It is not necessary to specify the suffixes/extensions (in the list of suffixes/extensions) as in the registry under HKEY_CLASSES_ROOT. That is, specifying the leading period in an extension/suffix is optional. |
The function does not appear to access the specified file system object in order to determine its extension. |
Example |
---|
PROCEDURE TForm4.TestShlWAPIPathFindSuffixArray(Sender : TObject); VAR pathandname : STRING; //Contains the file name of which to determine the suffix/extension VAR extensionarr : ARRAY[0..7] OF STRING; //Array consisting of the suffixes/extensions to test the name for VAR extensionarrp : PChar; VAR retsuffixp : PChar; VAR numsuffixes : INTEGER; VAR newinfoline : STRING; BEGIN pathandname := ''; //extensionarr := ''; extensionarrp := NIL; retsuffixp := NIL; numsuffixes := 0; newinfoline := ''; pathandname := 'C:\Windows\Explorer.exe'; extensionarr[0] := 'dll'; extensionarr[1] := 'Exe'; extensionarr[2] := '.exe'; extensionarrp := @extensionarr[0]; numsuffixes := 3; newinfoline := 'PathFindSuffixArray called with : "' + pathandname + '" returned '; Memo1.Lines.Add(newinfoline); retsuffixp := PathFindSuffixArray(PChar(pathandname), extensionarrp, numsuffixes); newinfoline := retsuffixp; Memo1.Lines.Add(newinfoline); pathandname := 'regedit.exe'; extensionarr[0] := 'dll'; extensionarr[1] := '.Exe'; extensionarr[2] := 'exe'; extensionarrp := @extensionarr[0]; numsuffixes := 3; newinfoline := 'PathFindSuffixArray called with : "' + pathandname + '" returned '; Memo1.Lines.Add(newinfoline); retsuffixp := PathFindSuffixArray(PChar(pathandname), extensionarrp, numsuffixes); newinfoline := retsuffixp; Memo1.Lines.Add(newinfoline); Memo1.Lines.Add(''); END; |
The above example produces the following output: |
PathFindSuffixArray called with : "C:\Windows\Explorer.exe" returned .exe PathFindSuffixArray called with : "regedit.exe" returned exe |
Requirements | |
---|---|
Unit: | Declared and imported in (SST)ShlWAPI.pas |
Library: | (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj |
Unicode: | Implemented as ANSI (PathFindSuffixArray and PathFindSuffixArrayA) and Unicode (PathFindSuffixArrayW) functions. |
Min. ShlWAPI.dll version according to MS SDK doc.: | 5.0 |
Min. ShlWAPI.dll version based on SST research: | 5.0 |
Min. OS version(s) according to Microsoft SDK doc.: | Windows 2000, Windows NT 4.0 with Internet Explorer 5, Windows 98, Windows 95 with Internet Explorer 5 |
Min. OS version(s) according to SST research.: | Windows NT 4.0 with IE 5, Windows 98, Windows 95 with IE 5, Windows 2000 and later |
See Also |
---|
PathFindFileName, PathFindExtension, PathFindNextComponent, PathGetArgs |
Windows APIs: PathFindSuffixArray, PathFindFileName, PathFindExtension, PathFindNextComponent, PathGetArgs |
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 |