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

Is and FILE_LOCKED on XP returning false positive


6 replies to this topic

joephayes

joephayes
  • Members
  • 17 posts

Posted 09 January 2004 - 17:19

Hi all,

I'm using Installshield Developer 8.0 SP2. I have a custom action which checks to see if Excel is running. I use the Installscript "Is" function with the FILE_LOCKED argument. With one client, the function always returns TRUE even though Excel is not running. The client is using XP SP1. Has anyone else run across this?

Thanks!

Joe Hayes

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 10 January 2004 - 14:55

Does it really return TRUE (= 1), or maybe a value < 0? Note that the Is function has multiple possible return values. Only 1 means TRUE, 0 means FALSE and < 0 are error codes.

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 11 January 2004 - 04:08

I have never had this problem with Installscript, but I used Wise Installmaster earlier and then the "check file in use" feature would return true if the EXE file was read only (that is it would return in-use even if the file was not in use, just read-only).
Regards
-Stein Åsmul

Balachandar

Balachandar
  • Members
  • 23 posts

Posted 12 January 2004 - 17:52

Try to check for the current running process "Excel". There are several articles in this forum that explains "How to get a list of processes running in the system". There you can check if "Excel" is running.

Cheers,
Bala

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 12 January 2004 - 20:44

Here is some code that I use to detect running office applications:

CODE

///////////////////////////////////////////////////////////////////////////////
//                                                                          
//  Function:  IsOfficeEXEInUse
//                                                                          
//  Purpose:   Checks whether any Microsoft Office executables are in use
//             during installation / uninstallation. Pops up a warning to the
//             user to close down the applications if they are found to be
//             open. The function will not "force" the closing of the
//             applications, it will just warn the user once. The warning may
//             show up several times if the new setup is installed on top of
//             an existing installation.
//
//////////////////////////////////////////////////////////////////////////////

function IsOfficeEXEInUse ( hMSI )
  STRING szOutlookFolder, szOutlookRegistryPath;
  STRING szPowerPointFolder, szPowerPointRegistryPath;
  STRING szProjectFolder, szProjectRegistryPath;
  STRING szWordFolder, szWordRegistryPath;
  NUMBER nOutlookLocked, nProjectLocked, nWordLocked, nPowerPointLocked;
  NUMBER nvType, nvSize;
begin

 // Assume default installation folder (if no reg key found)
   
 // Outlook
 szOutlookFolder = PROGRAMFILES ^ "Microsoft Office\\Office";
 szOutlookRegistryPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\OUTLOOK.EXE";
       
 // Project
 szProjectFolder = PROGRAMFILES ^ "Microsoft Office\\Office";
 szProjectRegistryPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\WINPROJ.EXE";
   
 // Power Point
 szPowerPointFolder = PROGRAMFILES ^ "Microsoft Office\\Office";
szPowerPointRegistryPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\POWERPNT.EXE";
   
 // Word
 szWordFolder = PROGRAMFILES ^ "Microsoft Office\\Office";
 szWordRegistryPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\WINWORD.EXE";
   
 // Work in the HKLM section of the registry
 RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );

 // Read the installation folder from the registry
 RegDBGetKeyValueEx ( szOutlookRegistryPath, "Path", nvType, szOutlookFolder, nvSize );
 RegDBGetKeyValueEx ( szProjectRegistryPath, "Path", nvType, szProjectFolder, nvSize );
 RegDBGetKeyValueEx ( szPowerPointRegistryPath, "Path", nvType, szPowerPointFolder, nvSize );  
 RegDBGetKeyValueEx ( szWordRegistryPath, "Path", nvType, szWordFolder, nvSize );

 // Detect if any of the MS Office application executables are in use
 nOutlookLocked = Is ( FILE_LOCKED, szOutlookFolder ^ "OUTLOOK.EXE" );
 nProjectLocked = Is ( FILE_LOCKED, szProjectFolder ^ "WINPROJ.EXE" );
 nWordLocked = Is ( FILE_LOCKED, szWordFolder ^ "WINWORD.EXE" );
 nPowerPointLocked = Is ( FILE_LOCKED, szPowerPointFolder ^ "POWERPNT.EXE" );    
                                                                           
 if (nOutlookLocked = 1) ||(nProjectLocked = 1) || (nWordLocked = 1) || (nPowerPointLocked = 1) then
       
  SetDialogTitle ( DLG_MSG_INFORMATION, @Generic_Information );
  MessageBox ( @Error_OfficeEXEInUse, INFORMATION );
 
endif;      

end;


Edited by Glytzhkof, 12 January 2004 - 20:49.

Regards
-Stein Åsmul

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 13 January 2004 - 18:53

To force people to close down office apps you just need to use a while loop instead of the if statement.
Regards
-Stein Åsmul

joephayes

joephayes
  • Members
  • 17 posts

Posted 05 February 2004 - 18:09

Thank you very much!