Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.29 KB

StrDup.md

File metadata and controls

50 lines (33 loc) · 1.29 KB

Home

Function name : StrDup

Group: Shell Lightweight Utility APIs -- string functions - Library: shlwapi


Duplicates a string.


Code examples:

StrDup returns a pointer to the duplicate of a source VFP string
Using Common Controls: the Header Control

Declaration:

LPTSTR StrDup(
    LPCTSTR lpsz
);  

FoxPro declaration:

DECLARE INTEGER StrDup IN shlwapi;
	STRING lpsz  

Parameters:

lpsz [in] Pointer to a constant null-terminated character string.


Return value:

Returns the address of the string that was copied, or NULL if the string cannot be copied.


Comments:

MSDN: this function uses LocalAlloc to allocate storage space for the copy of the string. The calling application must free this memory by calling the LocalFree function on the pointer returned by the call to StrDup.

StrDup will allocate storage the size of the original string. If storage allocation is successful, the original string is copied to the duplicate string.