Recent

Author Topic: Opening a file in an existing application instance  (Read 4303 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Opening a file in an existing application instance
« on: March 26, 2011, 10:13:09 pm »
I've been using TProcess to open files in applications. As an example, to send a video file to VLC video player. This works, however, every call to TProcess creates a new instance of VLC. Is there a way to send a file to an open application without creating a new instance?

Ideally, I'd like to be able to mimic the OS X Finder behavior and to access default applications, but not opening multiple instances is a reasonable start.

Any comments appreciated.

Frederick

“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Opening a file in an existing application instance
« Reply #1 on: March 26, 2011, 10:27:37 pm »
Code: [Select]
  // uses LCLIntf
  OpenDocument(Filename); 

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Opening a file in an existing application instance
« Reply #2 on: March 26, 2011, 11:17:39 pm »
Code: [Select]
  // uses LCLIntf
  OpenDocument(Filename); 

That works perfectly, and is much easier. I just had to quote the file path to make it work.

Thank you typo! Very much appreciated.

Cheers,
Frederick
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

 

TinyPortal © 2005-2018