Single instance lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- slicke · 2020-05-17 12:31 Hi! I was wondering how to handle single instance apps in macOS. On Windows for instance you can manually handle the issue, since Windows will launch a new instance when for instance opening a file. After that you can pass on the file name to the running instance and open it. However, on macOS - if my app is open - it will be brought to the front. Thus my problem is that if my app is open, and the user opens a file, I need to know that a) my app was called and b) get the ParamStrs to act on the file name. Is there an event handler or something for this? Thanks in advance! ---------------------------------------------------------------------- howardpc · 2020-05-17 12:51 The Application instance provides SingleInstanceEnabled, and SingleInstanceClass. I'm not sure if this meets your need or not. ---------------------------------------------------------------------- trev · 2020-05-17 12:58 @slicke I'm not quite sure what you're asking. If your application handles .xyz files, your user has opened one .xyz file already and your user double-clicks on another file .xyz file, your existing application instance should open it. You shouldn't need to do anything. ---------------------------------------------------------------------- slicke · 2020-05-17 13:37 Thanks for your replies What I mean is, if I open a .xyz file, my app starts and I use ParamStr to find out what parameter was used to start it. Eg I read the first parameter (File.xyz) passed in the launch command the OS uses, like the opening of Filöe.xyz in finder triggers a command line action of "myapp File.xyz". That action is processed with ParamStr in my startup function. Now, when it's open - How do I know if someone has opened File2.xyz? The start-up/create function only triggers when the app first is openbed. What happens now is that my app gets brought to the front when I click a file, but I'd also like to trigger some action in the app to find out what the name was. Thanks ---------------------------------------------------------------------- slicke · 2020-05-18 08:40 Thanks! I solved it. I think I was too focused on the old Delphi way of doing things. Thanks for your time! ---------------------------------------------------------------------- trev · 2020-05-18 13:06 How? (Also, please edit the first post's subject line and add [SOLVED].)