Function ShellLinkCreate() Foundation
Create a Shell link object.
ShellLinkCreate( <cLinkTarget>, <cLinkFile>, [<cWorkingDir>],;
[<cCmdArgs>], [<cDescr>] ) --> <lSuccess>
ShellLinkCreate() returns a logical value that indicates whether the link could be created. In this case, the value .T. (true) is returned. In case of an error, return is .F. (false).
The function ShellLinkCreate() can be used by an Xbase++ application to create a Shell link object. A link object points to another file or folder and can be placed independently of its target object. Links are frequently used to allow quick access to files or folders.
PROCEDURE Main()
LOCAL bFileExists := .F.
LOCAL nFile
//
// Create a dummy file to serve as the target
// for the link about to be created
IF File("samplelink.lnk") == .T.
Alert( "Cant't run sample - a link of the same name already exists!" )
QUIT
ENDIF
IF File("samplefile.txt") == .F.
nFile := FCreate( "samplefile.txt" )
FClose( nFile )
ELSE
bFileExists := .T.
ENDIF
//
// Create a Shell link to the dummy file,
// specify a dummy string as the link
// object's description
//
ShellLinkCreate( CurDirectory() + "\" + "samplefile.txt", ;
"samplelink.lnk",,,;
"Test Description" )
WAIT "Link created. Press a key to resolve it."
//
// Resolve the link just created
//
? "Link target is: " + ShellLinkResolve( "samplelink.lnk" )
?
WAIT
//
// Clean up
//
FErase( "samplelink.lnk" )
IF bFileExists == .F.
FErase( "samplefile.txt" )
ENDIF
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.