12-27-2016 02:14 PM
I'm trying to launch wordpad and have it open a specific file using LaunchExecutableEx. The problem arises when the specific file i want to open or its path contains a blank character, all characters after the blank character are trunciated and wordpad complans that it can't fine the file and closes. Is there away arouind?
eg.
Fmt(fname, "%s<%s", "C:\\ Test it\\TestFile One.asc");
Fmt(launchFile, "%s<%s %s", "C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe", fname);
error = LaunchExecutableEx (launchFile, LE_SHOWNORMAL, &handle);
12-27-2016 04:19 PM
Wordpad requires the filename to be enclosed in double quotes in case the pathname contains spaces. You can obtain this by adding a '\042' before and after the document pathname (042 being the octal equivalent of 34 which is the ascii code for double quotes)
Fmt (fname, "%s<%s", "C:\\temp\\fuffa\\prova testo.txt"); Fmt (launchFile, "%s<%s \042%s\042", "C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe", fname); LaunchExecutableEx (launchFile, LE_SHOWNORMAL, NULL);
Enclosing in double quotes pathnames that include spaces is somewhat standard in Windows, even if some programs like notepad tolerate document pathnames that includes spaces without them.
12-28-2016 05:47 AM
Thanks for your reply