![]() |
(SST) ShlWAPI.pas Version 1.08 |
---|---|
Developer Reference |
Checks if a path is compliant with the Universal Naming Conventions (UNC). |
Scope |
---|
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas). |
Parameters | |
---|---|
pszPath [in] | Depending on which version of the function is called the pointer to a null-terinated, ANSI or Unicode string, that is the path of which to validate the syntax. |
Return Values |
---|
The function returns FALSE if the string is not a fully qualified path that has the UNC form
|
Remarks |
---|
Unlike some other Windows API functions that handle/digest path strings, PathIsUNC does not convert slashes ("/") into backslashes ("\") and will therefore return FALSE, even if otherwise the specified path has the correct format. |
Example |
---|
PROCEDURE TForm4.TestShlWAPIPathIsUNC(Sender : TObject); VAR pathtotest : STRING; VAR apiretval : BOOL; VAR newinfoline : STRING; BEGIN pathtotest := ''; apiretval := FALSE; newinfoline := ''; pathtotest := 'C:\Windows\System32'; newinfoline := 'PathIsUNC called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsUNC(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); pathtotest := '\\WORKSTATION1\Public'; newinfoline := 'PathIsUNC called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsUNC(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); pathtotest := '\\WEBSERVER1\I\Website\DevRef.htm'; newinfoline := 'PathIsUNC called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsUNC(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); pathtotest := 'd:/topleveldir/subdir1/subdir2'; newinfoline := 'PathIsUNC called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsUNC(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); pathtotest := '//WEBSERVER1/ShareDir/Website/DevRef.htm'; newinfoline := 'PathIsUNC called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsUNC(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); pathtotest := '..\Windows\Temp\'; newinfoline := 'PathIsUNC called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsUNC(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); Memo1.Lines.Add(''); END; |
The above example produces the following output: |
PathIsUNC called with C:\Windows\System32 FALSE PathIsUNC called with \\WORKSTATION1\Public TRUE PathIsUNC called with \\WEBSERVER1\I\Website\DevRef.htm TRUE PathIsUNC called with d:/topleveldir/subdir1/subdir2 FALSE PathIsUNC called with //WEBSERVER1/ShareDir/Website/DevRef.htm FALSE PathIsUNC called with ..\Windows\Temp\ FALSE |
Requirements | |
---|---|
Unit: | Declared and imported in (SST)ShlWAPI.pas |
Library: | (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj |
Unicode: | Implemented as ANSI (PathIsUNC and PathIsUNCA) and Unicode (PathIsUNCW) 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 |
---|
TSSTNewClass.Create, SSTNewUnit, PathIsDirectory, PathIsDirectoryEmpty, PathIsRelative, PathIsRoot, PathIsSystemFolder, PathIsUNCServer, PathIsUNCServerShare PathIsURL |
Windows APIs: GetLastError, SetLastError PathIsDirectory, PathIsDirectoryEmpty, PathIsRelative, PathIsRoot, PathIsSystemFolder, PathIsUNCServer, PathIsUNCServerShare PathIsURL |
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 |