Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt QDesktopServices::openUrl() error 2
I am trying to copy an executable program into a folder and run immediately using Qt QDesktop Service . ( Qt 5.7 On Windows 10 ) . It was working well as expected.
On my colleague's Windows 10 , the program giving "Qt QDesktopServices :: openUrl() error 2" in Qt Creator window during the execution time.
The code is same and relevant header files included. including the windeployqt. ie. any stand alone (not from Qt creator) Qt .exe file runs without problem.
Any thoughts/ suggestions highly useful.
Please share the code responsible for copying and calling openUrl().
- Are you 100% sure that the copy operation is successful?
- What kind of file are you trying to open? Does your friend's machine open that file correctly when they double-click on it in Windows Explorer?
Something is not clear here. Do you mean that he gets that when building the application ?
@sierdzio clarification: Copy operation and execution both not successful for .exe file and in the same directory the ..txt file copied correctly. Basically, i doing duplication of TXT and EXE files. EXE files should be copied and after that it should run using Qt Desktop services. Where as TXT files are just copying only.
@SGaist After successful build, try to run from QtCreator and the application output windows shows this error but other GUI pop-up happens as expected. Hope this helps
error 2or did it print something more ?
@SGaist The error like -- ShellExecute ' xxxx' failed (error 2).
The xxxx part i am not sure. Will check my colleague update here. Thanks :)
Copy operation and execution both not successful for .exe
Well, if copying fails it is perfectly clear why
openUrl()does not work: it is because the file is missing (not copied). So, you need to fix the copying first.
As said, please show us the relevant parts of your code and maybe we'll be able to help you.
@sierdzio yes, you are . My colleague said, she solved it. not sure. Appreciate your team spirit :) Thanks.