From: Tim_Gooch@mm.cobb.ziff.com Subject: Re: [delphi] HPrevInst Date: Thu, 20 Jul 1995 09:30:14 -0500 (EST) >> How do I set the application to make use of this. Try this in the project source file: ==================================================== {usual stuff at the top of the project source file var hwnd: Word; begin if hPrevInst = 0 then begin Application.CreateForm(TForm1, Form1); Application.Run; end else begin hwnd := FindWindow('TForm1', nil); if (not IsWindowVisible(hwnd)) then begin ShowWindow(hwnd, sw_ShowNormal); PostMessage(hwnd, wm_User, 0, 0); end; else SetWindowPos(hwnd, HWND_TOP, 0,0,0,0, SWP_NOSIZE or SWP_NOMOVE); end; end. ==================================================== In the form's PAS file add a message response function for the wm_User message. ==================================================== {in the form declaration} public procedure WMUser(var msg: TMessage); message wm_User; {in the implementation section} procedure TForm1.WMUser(var msg: TMessage); begin Application.Restore; end; ==================================================== (This tip courtesy of Marco Cantu') Tim Gooch Editor-in-chief - Borland C++ Developer's Journal - Delphi Developer's Journal