Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Qt QDesktopServices::openUrl() error 2

    General and Desktop
    3
    9
    2736
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Chandras002
      Chandras002 last edited by

      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.

      Cheers!
      chandra

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        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?

        (Z(:^

        Chandras002 1 Reply Last reply Reply Quote 1
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          Something is not clear here. Do you mean that he gets that when building the application ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Chandras002 1 Reply Last reply Reply Quote 1
          • Chandras002
            Chandras002 @sierdzio last edited by

            @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.

            sierdzio 1 Reply Last reply Reply Quote 0
            • Chandras002
              Chandras002 @SGaist last edited by

              @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

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                Just error 2 or did it print something more ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                Chandras002 1 Reply Last reply Reply Quote 0
                • Chandras002
                  Chandras002 @SGaist last edited by

                  @SGaist The error like -- ShellExecute ' xxxx' failed (error 2).
                  The xxxx part i am not sure. Will check my colleague update here. Thanks :)

                  1 Reply Last reply Reply Quote 0
                  • sierdzio
                    sierdzio Moderators @Chandras002 last edited by

                    @Chandras002 said in Qt QDesktopServices::openUrl() error 2:

                    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.

                    (Z(:^

                    Chandras002 1 Reply Last reply Reply Quote 1
                    • Chandras002
                      Chandras002 @sierdzio last edited by

                      @sierdzio yes, you are . My colleague said, she solved it. not sure. Appreciate your team spirit :) Thanks.

                      cheers!
                      chandra

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post