![]() |
(SST) ShlWAPI.pas Version 1.08 |
---|---|
Developer Reference |
Forms a fully qualified or relative path string from two, separate path components. |
Scope |
---|
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas). |
Parameters | |
---|---|
szDest [out] | A pointer to the buffer into which the NULL-terminated, ANSI or Unicode output string should be written. |
lpszDir [in] | Pointer to the null-terminated string that is the folder/directory component of the path to create. This string, including the terminating null-character, should not exceed MAX_PATH (= 260) characters in length. |
lpszFile [in] | Pointer to null-terminated string that is the file or final folder/directory of the path to create. This string, including the terminating null-character, should not exceed MAX_PATH (= 260) characters in length. |
Return Values |
---|
If the function was able to combine both components to a single path, it writes the output string into the provided buffer and returns a pointer to the concatenated path string. If the function fails the returned pointer is NIL. |
Remarks |
---|
Whereas the folder/directory component may be an empty string or NIL, the file name component (the last parameter) may not. |
The file name component (i.e. the lpszFile parameter) does not have to include a file suffix/extension, nor the period that separates the name from the suffix/extension. The function can therefore also be used to form the path to a folder/directory. |
The function does not verify the existence of either input, path component, nor that of the created, output path. |
Example |
---|
PROCEDURE TForm4.TestShlWAPIPathCombine(Sender : TObject); VAR dirpartstr : STRING; VAR filepartstr : STRING; VAR pathstrbuf : ARRAY[0.. MAX_PATH] OF CHAR; VAR apiretval : PChar; VAR newinfoline : STRING; BEGIN dirpartstr := ''; filepartstr := ''; FillChar(pathstrbuf, Length(pathstrbuf), #0); apiretval := NIL; newinfoline := ''; dirpartstr := 'C:\Hello\World\'; filepartstr := 'DummyFileName.txt'; newinfoline := 'PathCombine called with ' + dirpartstr + ' and ' + filepartstr; Memo1.Lines.Add(newinfoline); apiretval := PathCombine(pathstrbuf, PChar(dirpartstr), PChar(filepartstr)); newinfoline := pathstrbuf; Memo1.Lines.Add(newinfoline); dirpartstr := '..\Hello\World\'; filepartstr := '..\SubDir\DummyFileName.txt'; newinfoline := 'PathCombine called with ' + dirpartstr + ' and ' + filepartstr; Memo1.Lines.Add(newinfoline); apiretval := PathCombine(pathstrbuf, PChar(dirpartstr), PChar(filepartstr)); newinfoline := pathstrbuf; Memo1.Lines.Add(newinfoline); Memo1.Lines.Add(''); END; |
The above example produces the following output: |
PathCombine called with C:\Hello\World\ and DummyFileName.txt C:\Hello\World\DummyFileName.txt PathCombine called with ..\Hello\World\ and ..\SubDir\DummyFileName.txt Hello\SubDir\DummyFileName.txt |
Requirements | |
---|---|
Unit: | Declared and imported in (SST)ShlWAPI.pas |
Library: | (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj |
Unicode: | Implemented as ANSI (PathCombine and PathCombineA) and Unicode (PathCombineW) 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 |
---|
PathAddExtension. |
Windows APIs: PathCombine, PathAppend, PathAddExtension. |
Document/Contents version 1.00 Page/URI last updated on 07.12.2023 |
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017 |
Suggestions and comments mail to: webmaster@stoelzelsoftwaretech.com |