Solved

Preventing Multiple Instances of Exe

Posted on 1998-12-17
3
420 Views
Last Modified: 2010-05-18
How can I prevent multiple instances of my application in Delphi 3?
0
Comment
Question by:fh1
3 Comments
 
LVL 7

Accepted Solution

by:
BlackMan earned 100 total points
ID: 1351706
There's an article about it here: http://www.delumpa.com/tips/apps/apps5.htm
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1351707
hi fh1,

there are components that takes the work foe you

i.e.:

http://www.torry.webnorth.com/vcl/system/gmjustone.zip
http://www.torry.webnorth.com/vcl/system/maininst.zip 
and more ..

meikl
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1351708
hi, fh.

just to add some code but url's -

var
 hwnd: Word;
 ...
if hPrevInst = 0 then
  // run your programm
else begin
  // is the window visible?
  hwnd := FindWindow(' (title of your window) ', nil);
  // if not, show it
  if (not IsWindowVisible(hwnd)) then begin
    ShowWindow(hwnd, sw_ShowNormal);
    PostMessage(hwnd, wm_User, 0, 0);
  end
  // else bring to top
  else
    SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE);
end;

bye,

Black Death.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question