Re: How To Use wxShell or wxExecute Without Opening A Console Window
- Posted by euphoric (admin) Apr 07, 2023
- 754 views
Thank you, @ghaberek. My issue has been resolved.
I'm using the 'start' command in Windows. That might be the culprit.
I assume you're using something like cmd.exe /C start <filename> to start the default application for a file and you're running your app with euiw.exe.
I didn't have cmd.exe in my prompt.
sequence cmd = "start /min winword /q /z\"" & template & "\"" wx_execute(cmd) --system_exec(cmd) --wx_shell( cmd )
In context, it was doing a test for the Windows version, then calling some function based on that. It seems, however, that it was constantly defaulting to using wx_shell(), which I think was the root of the problem.
So, it seems that was a bug in my code, and that using a commandline of "start" without cmd.exe shouldn't have even worked, so it was always calling wx_shell(), which I'm guessing opens a commandline console and runs the given prompt.
So I guess we need to write our own wxLaunchDefaultApplication...
...which works perfectly for Windows 11. I'm just going to cross my fingers that it works across all prior versions of Windows. (Yes, there will be tests later.)
Thank you, @ghaberek! I owe you coffee AND lunch.