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. Check file is open or not
Qt 6.11 is out! See what's new in the release blog

Check file is open or not

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 7 Posters 12.3k Views 3 Watching
  • 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.
  • Pradeep KumarP Pradeep Kumar

    @Gaurav-Badgujar

    u may look into the below link

    https://forum.qt.io/topic/51169/how-to-check-whether-file-already-open-or-not-in-qt

    i hope this is what ur topic says.

    Thanks,

    G Offline
    G Offline
    Gaurav Badgujar
    wrote on last edited by
    #9

    @Pradeep-Kumar yup .. but i want solution.

    1 Reply Last reply
    0
    • G Gaurav Badgujar

      @J.Hilk its not working with this.

      i opened excel file in ms-excel and i want to check excel file is open or not.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #10

      @Gaurav-Badgujar said in Check file is open or not:

      i opened excel file in ms-excel and i want to check excel file is open or not.

      What? You open an Excel file in Excel and then you want to check whether Excel opened the file?
      Do you open this Excel file manually or from your Qt app? Why do you want to check this?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Gaurav-Badgujar said in Check file is open or not:

        i opened excel file in ms-excel and i want to check excel file is open or not.

        What? You open an Excel file in Excel and then you want to check whether Excel opened the file?
        Do you open this Excel file manually or from your Qt app? Why do you want to check this?

        G Offline
        G Offline
        Gaurav Badgujar
        wrote on last edited by
        #11

        @jsulm yes open manually and want to check for requirement.

        jsulmJ 1 Reply Last reply
        0
        • G Gaurav Badgujar

          @jsulm yes open manually and want to check for requirement.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #12

          @Gaurav-Badgujar Do you want to check this in your Qt app?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          G 1 Reply Last reply
          1
          • jsulmJ jsulm

            @Gaurav-Badgujar Do you want to check this in your Qt app?

            G Offline
            G Offline
            Gaurav Badgujar
            wrote on last edited by
            #13

            @jsulm yes

            mrjjM 1 Reply Last reply
            1
            • G Gaurav Badgujar

              @jsulm yes

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #14

              @Gaurav-Badgujar

              There is no Qt way of doing this.
              Its pr. operating system and you will need to use native API to do it.

              for windows
              https://stackoverflow.com/questions/1951791/how-to-check-if-a-file-is-already-open-by-another-process-in-c

              1 Reply Last reply
              4
              • EddyE Offline
                EddyE Offline
                Eddy
                wrote on last edited by
                #15

                You can check if a specific Excel file is open using ActiveQt

                get all WorkBooks, iterate over them and check if the name of the workbook you touch corresponds to the one you want.
                If that is the case, your excel file is already open.

                Qt Certified Specialist
                www.edalsolutions.be

                mrjjM 1 Reply Last reply
                2
                • EddyE Eddy

                  You can check if a specific Excel file is open using ActiveQt

                  get all WorkBooks, iterate over them and check if the name of the workbook you touch corresponds to the one you want.
                  If that is the case, your excel file is already open.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #16

                  @Eddy
                  That is not a bad idea.
                  I even think that
                  ThisWorkbook.FullName
                  Workbook.FullName
                  will give full path to file.

                  1 Reply Last reply
                  1
                  • EddyE Offline
                    EddyE Offline
                    Eddy
                    wrote on last edited by
                    #17

                    @mrjj
                    Yes, that is possible, but other files can be open already and the one we want to check is not necessarily the active one.

                    Eddy

                    Qt Certified Specialist
                    www.edalsolutions.be

                    mrjjM 1 Reply Last reply
                    2
                    • EddyE Eddy

                      @mrjj
                      Yes, that is possible, but other files can be open already and the one we want to check is not necessarily the active one.

                      Eddy

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #18

                      @Eddy
                      Oh bad naming. I did mean when he looped over all open.

                      1 Reply Last reply
                      1

                      • Login

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