Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt QDesktopServices::openUrl() error 2

Qt QDesktopServices::openUrl() error 2

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 3.5k Views
  • 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.
  • Chandras002C Offline
    Chandras002C Offline
    Chandras002
    wrote on last edited by
    #1

    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
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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(:^

      Chandras002C 1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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

        Chandras002C 1 Reply Last reply
        1
        • sierdzioS sierdzio

          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?
          Chandras002C Offline
          Chandras002C Offline
          Chandras002
          wrote on last edited by
          #4

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

          sierdzioS 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

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

            Chandras002C Offline
            Chandras002C Offline
            Chandras002
            wrote on last edited by
            #5

            @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
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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

              Chandras002C 1 Reply Last reply
              0
              • SGaistS SGaist

                Just error 2 or did it print something more ?

                Chandras002C Offline
                Chandras002C Offline
                Chandras002
                wrote on last edited by
                #7

                @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
                0
                • Chandras002C Chandras002

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

                  sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #8

                  @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(:^

                  Chandras002C 1 Reply Last reply
                  1
                  • sierdzioS sierdzio

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

                    Chandras002C Offline
                    Chandras002C Offline
                    Chandras002
                    wrote on last edited by
                    #9

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

                    cheers!
                    chandra

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved