Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP Support for LONG filenames 1

Status
Not open for further replies.

VicGarra

Programmer
Jun 6, 2001
6
AU
We are using the following code to run a POWERPOINT pps slide show from VFP7 - uses Microsoft PPVIEWER.exe Using XP Pro

oWSH = CREATEOBJECT(WSCRIPT.Shell)
oWSH.Run([YourFile.PPS],1,.t.)

Runs OK if YourFile is 8 characters or less - otherwise causes ans OLE error.

Is the problem VFP7 does not support long file names - VFP8 VFP9 ???

Has anyone a ready explanation or is there another solution - Please ??

 
You might try using the shellexecute method instead:

Code:
ShellOut("Myfilenameisbiggerthan8chars.pps","")

FUNCTION ShellOut
	PARAMETER m.FILENAME,m.LINEPARAMS
	LOCAL LNRETVAL, LCOPERATION
	PRIVATE m.FILENAME,m.LINEPARAMS
	LCOPERATION = "Open"
	**
	DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
		INTEGER handle,;
		STRING @sFile,;
		STRING @lp,;
		STRING @DIR,;
		STRING @dir1,;
		INTEGER ncmd
	**
	IF PCOUNT() < 2
		M.LINEPARAMS = ""
	ENDIF
	LNRETVAL = SHELLEXECUTE(0, LCOPERATION, m.FILENAME, m.LINEPARAMS, "", 1)
	CLEAR DLLS SHELLEXECUTE
	RETURN(.F.)

Regards

Griff
Keep [Smile]ing
 
Hi VicGarra,

Your code DOES work with long filenames (I've used similar code many times). Nor is it a VFP issue. All versions of VFP support long filenames.

The probem with using wscript.sshell is that it doesn't support filenames that contain spaces. But the solution is quite simple: put the filename within double-quotes.

For example:

oWSH.Run([Your File.PPS],1,.t.)

That will fail. But:

oWSH.Run(["Your File.PPS"],1,.t.)

should work ok.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hello Vicgarra: Its not VFP but the PPViewer. It only supports 8 character or less names. Though 2007, I have been told, will support long file names. As stated earlier, I connot confirm this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top