Solved

Preventing Multiple Instances of Exe

Posted on 1998-12-17
3
413 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PDF files into SQL 2008 Varbinary(Max) 3 77
Thread safe  opinion 7 111
delphi exception 7 58
LAN or WAN ? 11 61
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now