Author | Topic: Run Shell File Open Options??? | |
---|---|---|
Jonathan Leeming | Run Shell File Open Options??? on Thu, 27 Jan 2022 11:28:35 -0700 Hi, I recently upgraded a pc to Windows 11 ver 21H2 and found a process that I use to open various files with their default applications such as Word or Excel has become exceeding slow. With the same version of Xbase 2.0.1520 and same version of MS Office 2019 (ver 1808 build 10382.20034) on Windows 10 opening an Excel sheet or Word document is a couple of seconds while with Windows 11 it is more like 30 seconds and even once open Excel is very slow (jerky) to respond. I normally use tdRunShell() from Clayton's Topdown Library (worked great until now) that is basically a wrapper for: hWnd := SetAppWindow():getHWND() cOperation := "open" cPathName := "c:\path\SomeFile.xlsx" cParams := NIL cPath := "c:\path\" nShowCmd := 3 DllCall("shell32.DLL", DLL_STDCALL, "ShellExecuteA", ; hWnd,cOperation,cPathname,cParams,cPath,nShowCmd) But now with Windows 11 the ShellExecuteA is too slow but if I instead use Alaska's RunShell() it is quick but does not work with certain characters in the file name. cFileName := "c:\path\SomeFile.xlsx" RunShell( "/C explorer.exe "+cFileName,, .T., .T. ) It is quick but unlike the ShellExecuteA option it will not work with file names containing these 3 characters: &^, These 3 are valid Windows file name characters and I don't have control as to what file names the end user creates. Does anyone have a suggestion as to alternate methods of opening a file using the Windows default program? Thanks... any suggestions appreciated... Jonathan | |
Jonathan Leeming | Re: Run Shell File Open Options??? on Thu, 27 Jan 2022 12:43:33 -0700 On 1/27/2022 11:28 AM, Jonathan Leeming wrote: > Hi, > > I recently upgraded a pc to Windows 11 ver 21H2 and found a process that > I use to open various files with their default applications such as Word > or Excel has become exceeding slow. With the same version of Xbase > 2.0.1520 and same version of MS Office 2019 (ver 1808 build 10382.20034) > on Windows 10 opening an Excel sheet or Word document is a couple of > seconds while with Windows 11 it is more like 30 seconds and even once > open Excel is very slow (jerky) to respond. > > I normally use tdRunShell() from Clayton's Topdown Library (worked great > until now) that is basically a wrapper for: > > hWnd := SetAppWindow():getHWND() > cOperation := "open" > cPathName := "c:\path\SomeFile.xlsx" > cParams := NIL > cPath := "c:\path\" > nShowCmd := 3 > > DllCall("shell32.DLL", DLL_STDCALL, "ShellExecuteA", ; > hWnd,cOperation,cPathname,cParams,cPath,nShowCmd) > > But now with Windows 11 the ShellExecuteA is too slow but if I instead > use Alaska's RunShell() it is quick but does not work with certain > characters in the file name. > > cFileName := "c:\path\SomeFile.xlsx" > > RunShell( "/C explorer.exe "+cFileName,, .T., .T. ) > > It is quick but unlike the ShellExecuteA option it will not work with > file names containing these 3 characters: &^, > > These 3 are valid Windows file name characters and I don't have control > as to what file names the end user creates. > > Does anyone have a suggestion as to alternate methods of opening a file > using the Windows default program? > > Thanks... any suggestions appreciated... Jonathan > Hi, Some dummy thought of enclosing the cFileName in quotes as per: cFileName := '"'+'c:\path\SomeFile.xlsx'+'"' and it now correctly handles files with embedded: &^, Sorry for wasting anyone's time with this trivial issue! Thanks... Jonathan | |
Jonathan Leeming | Re: Run Shell File Open Options??? on Thu, 27 Jan 2022 13:38:16 -0700 On 1/27/2022 12:43 PM, Jonathan Leeming wrote: > On 1/27/2022 11:28 AM, Jonathan Leeming wrote: >> Hi, >> >> I recently upgraded a pc to Windows 11 ver 21H2 and found a process >> that I use to open various files with their default applications such >> as Word or Excel has become exceeding slow. With the same version of >> Xbase 2.0.1520 and same version of MS Office 2019 (ver 1808 build >> 10382.20034) on Windows 10 opening an Excel sheet or Word document is >> a couple of seconds while with Windows 11 it is more like 30 seconds >> and even once open Excel is very slow (jerky) to respond. >> >> I normally use tdRunShell() from Clayton's Topdown Library (worked >> great until now) that is basically a wrapper for: >> >> hWnd := SetAppWindow():getHWND() >> cOperation := "open" >> cPathName := "c:\path\SomeFile.xlsx" >> cParams := NIL >> cPath := "c:\path\" >> nShowCmd := 3 >> >> DllCall("shell32.DLL", DLL_STDCALL, "ShellExecuteA", ; >> hWnd,cOperation,cPathname,cParams,cPath,nShowCmd) >> >> But now with Windows 11 the ShellExecuteA is too slow but if I instead >> use Alaska's RunShell() it is quick but does not work with certain >> characters in the file name. >> >> cFileName := "c:\path\SomeFile.xlsx" >> >> RunShell( "/C explorer.exe "+cFileName,, .T., .T. ) >> >> It is quick but unlike the ShellExecuteA option it will not work with >> file names containing these 3 characters: &^, >> >> These 3 are valid Windows file name characters and I don't have >> control as to what file names the end user creates. >> >> Does anyone have a suggestion as to alternate methods of opening a >> file using the Windows default program? >> >> Thanks... any suggestions appreciated... Jonathan >> > Hi, > > Some dummy thought of enclosing the cFileName in quotes as per: > > cFileName := '"'+'c:\path\SomeFile.xlsx'+'"' and it now correctly > handles files with embedded: &^, > > Sorry for wasting anyone's time with this trivial issue! > > Thanks... Jonathan Hi Again, I found that: RunShell( "/C START explorer.exe "+cPathFile,, .T., .T. ) Gives the best experience with "START" added it as does not show the command window at all. Regards... Jonathan |