Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Feb : Multiple instances showing up in Windows Processes

www.cryer.info
Managed Newsgroup Archive

Multiple instances showing up in Windows Processes

Subject:Multiple instances showing up in Windows Processes
Posted by:"Mark Kimball" (mkimba..@sbcglobal.net)
Date:4 Feb 2007 14:47:04

I am never sure where to post questions like this, but here
goes...

For years, I have been using code in Delphi 5 that worked for
creating a single instance of an application.  It begins under
the Implementation section of the main form with the code:


var
  OldWindowProc: Pointer;
  MyMsg: LongInt;

function NewWindowProc(WindowHandle: HWND; TheMessage: LongInt;
  ParamW: LongInt; ParamL: LongInt) : LongInt stdcall;


and concludes at the end of the unit with:


begin
  ShowWindow(Application.Handle, SW_HIDE);
end.


This has always worked until recently on the laptop that I use
for application development.  When I try to start a second
instance of a running application, it does not start, but when
I close the first instance and try to restart the application,
nothing happens.  I have watched in Windows Task Manager under
the Processes tab and see an entry created for the second
instance, although as I said, it does not actually start.  The
second process remains and additional entries appear each time
I try to restart the application.  I cannot get the application
to restart unless I manually delete the multiple processes in
Windows Task Manager.

The strange part about all of this is that on my desktop (both
computers are running Windows XP), the application will work
correctly.  Multiple instances are not created and when I close
the original instance, I can restart it.  Does anyone have any
idea what the problem may be.  I have numerous clients who are
running various applications which use this code and now worry
that I might start getting support calls.

Replies:

www.cryer.info
Managed Newsgroup Archive