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. Open file into an already running program

Open file into an already running program

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 676 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.
  • 4 Offline
    4 Offline
    4oh4
    wrote on last edited by
    #1

    I've got a program setup to work with file opens (eg, movie.avi -> rightclick -> open with -> myprogram.exe) by reading the command line args when the program starts...

    doesn't seem to extend to a way to open a file into the running instance of a program if i 'open with' while the program is already running, it just opens another copy of that program.

    Does QT have a standardised way to handle this?

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, I had a similar problem, when a 2nd instance of my program is launched, I exit that and switch focus back to the 1st instance.

      I solved it by using the QSharedMemory class in Qt to communicate between the 2 instances of the same .exe file.

      4 1 Reply Last reply
      4
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        See QtSingleApplication

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        3
        • hskoglundH hskoglund

          Hi, I had a similar problem, when a 2nd instance of my program is launched, I exit that and switch focus back to the 1st instance.

          I solved it by using the QSharedMemory class in Qt to communicate between the 2 instances of the same .exe file.

          4 Offline
          4 Offline
          4oh4
          wrote on last edited by
          #4

          @hskoglund Thanks, finally got a chance to implement it and QSharedMemory was exactly what I needed <3

          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