Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8887273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:45:57+00:00 2026-06-14T21:45:57+00:00

With FireMonkey and a multi-platform application ( Windows + Mac OS X ), how

  • 0

With FireMonkey and a multi-platform application (Windows + Mac OS X), how to have only one instance of an application running at the same time?

If a previous instance is already running, how to set it as the desktop foreground window?

  • I can check if a file is locked:
    • not locked: I lock it and run normally
    • locked : find the previous version (on windows, I know how to.. but on mac ?) and set it as the foreground window
  • I can check how many times the same process is launched (ditto, on windows, ok, but how to do it on Mac OS X)
  • …
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:45:58+00:00Added an answer on June 14, 2026 at 9:45 pm

    Both for Windows and OSX you can get the list of running applications and check if yours is in the list before you close with a message. In OSX you can get the list with lauchedApplications method of NSWorkspace, and in Windows you can use the toolhelp32 library for same purpose.
    Here are the related codes from TPlatformExtensions class which I have blogged in my website.

    For OSX:

    uses Macapi.AppKit, Macapi.Foundation;
    
    class procedure TPlatformExtensionsMac.GetRunningApplications(
      Applist: TStringlist);
    var
      fWorkSpace:NSWorkSpace;
      list:NSArray;
      i: Integer;
      lItem:NSDictionary;
      key,value: NSString;
    begin
      fWorkSpace := TNsWorkspace.Wrap(TNsWorkSpace.OCClass.sharedWorkspace);
      list := fWorkspace.launchedApplications;
      if (List <> nil) and (List.count > 0) then
      begin
        for i := 0 to list.count-1 do
        begin
          lItem := TNSDictionary.Wrap(List.objectAtIndex(i));
          key := NSSTR(String(PAnsiChar(UTF8Encode('NSApplicationBundleIdentifier'))));
          // You can also use NSApplicationPath or NSApplicationName
          value := TNSString.Wrap(lItem.valueForKey(key));
          Applist.Add(String(value.UTF8String));
        end;
      end;
    end; 
    

    For Windows:

    uses Winapi.TlHelp32, Winapi.Windows;
    
    class procedure TPlatformExtensionsWin.GetRunningApplications(
      Applist: TStringlist);
    var
     PE: TProcessEntry32;
     Snap: THandle;
     fName: String;
    begin
      pe.dwsize:=sizeof(PE);
      Snap:= CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
      if Snap <> 0 then
      begin
        if Process32First(Snap, PE) then
        begin
         fName := String(PE.szExeFile);
         Applist.Add(fName);
         while Process32Next(Snap, PE) do
         begin
           fName := String(PE.szExeFile);
           Applist.Add(fName);
         end;
        end;
        CloseHandle(Snap);
      end;
    end; 
    

    If you need further information about the subject you can read my article on the subject.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Delphi XE2 Firemonkey application that I want to run on both
Here I have my Windows laptop with Delphi XE2 and Firemonkey. I've written a
We have a platform using VCL TFrame as rendering surface for OpenGL. Using FireMonkey,
Is there a way, to remove my firemonkey application form Windows XP/vista/7 taskbar? There
I'm writing a FireMonkey application which must run in Windows as well in OSX.
I have a simple FireMonkey application which loads an image file. It's my first
I have a TGridLayout filled with some images in a Firemonkey HD Application .
FireMonkey controls do not appear to have anchor properties as do VCL controls. How
For an iPhone Firemonkey application I am storing files (images) in the 'tmp' folder
I'm using Delphi XE2 with FireMonkey. I have read many other questions about MD5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.