Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Closing the Application before installation


1 reply to this topic

sukil_s

sukil_s
  • Members
  • 4 posts

Posted 22 January 2004 - 18:10

hi Guys
i want to install an upgraded version of an application but when i am installing it on the client machine i want to write acustom action which close the application before installation so could you please help me in this
Thanks in advance blink.gif

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 22 January 2004 - 19:47

I don't have any code that will automatically shut down a running application, but I am sure you can find that on http://www.installsite.org somewhere. Here is some code that will warn the user that the EXE is in use:

CODE

///////////////////////////////////////////////////////////////////////////////
//                                                                          
//  Function:  IsInUse
//                                                                          
//  Purpose:   Checks for running app
//////////////////////////////////////////////////////////////////////////////

function MM_IsInUse ( hMSI )
STRING szFolder, szRegFolder;
NUMBER nIsLocked, nvType, nvSize;
begin
   
   // Assume default installation folder (if no reg key found)
   szFolder = PROGRAMFILES ^ "Company\\Product";
   szRegFolder = "Software\\Company\\Product\\Version\\Installer";
   
// Work in the HKLM section of the registry
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );

// Read the installation folder from the registry
RegDBGetKeyValueEx ( szRegFolder, "MainDir", nvType, szFolder, nvSize );

// Check if TheEXE.exe exists in the MainDir folder
nIsLocked = Is ( FILE_LOCKED, szFolder ^ "TheEXE.exe" );
                                                                           
if (nIsLocked = 1) then
 SetDialogTitle ( DLG_MSG_SEVERE, @Warning_Generic );
 MessageBox ( @Error_EXEInUse, SEVERE );
 
   try
      abort;
      Err.Clear;
   catch
      SetDialogTitle ( DLG_MSG_SEVERE, @Error_Generic );
             MessageBox (@Error_AbortError, SEVERE);
             Err.Clear();
          endcatch;
   
 else
  //
endif;      

end;

Regards
-Stein Åsmul