Hope someone can help. I'm doing maintenance work on the installation of our product. A bug that I was assigned to fix is nothing more than a simple deletion of two files in a subdir of the target. Upon testing this fix from running the Setup.exe from my own personal build directory, it works fine. However, when I launch the Remove program from the Start menu, the fix does not take place. Is there something in InstallShield I have to do to "map" the Start menu Remove to run as it does/should as my build Remove?
Thanks.
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.
Simple file deletion not working from Start menu
Started by
ADB
, Jul 15 2002 21:33
5 replies to this topic
Posted 16 July 2002 - 14:40
For starters, running the straight setup and using the Add/Remove Program entry are two completely different things.
Running a normal setup will do its associated functions (i.e. typically OnFirstUIBeforeN, OnFirstUIAfter, etc.). Afterwards, running the resulting ARP entry will do its things (i.e. typically OnMainUIBefore, OnMaintUIAfter, etc.).
That's one reason you may be seeing different behavior.
Another is that since the original setup file is copied to the PC and subsequently re-used for Add/Remove Program, you must re-run your new one on afected machines before the "buggy" one will get replaced.
Hope it helps.
Running a normal setup will do its associated functions (i.e. typically OnFirstUIBeforeN, OnFirstUIAfter, etc.). Afterwards, running the resulting ARP entry will do its things (i.e. typically OnMainUIBefore, OnMaintUIAfter, etc.).
That's one reason you may be seeing different behavior.
Another is that since the original setup file is copied to the PC and subsequently re-used for Add/Remove Program, you must re-run your new one on afected machines before the "buggy" one will get replaced.
Hope it helps.
Posted 16 July 2002 - 19:15
Thanks for the update.
Question. I modified the OnMaintUIAfter, so my thought, not knowing too much about InstallShield, is that it will behave the same no matter where you run the setup.exe.
Having said that, I've tested this fix in many scenarios:
Scenario 1:
1. Build my env
2. Run Setup.exe to install from build
3. Run Setup.exe to uninstall from build
4. Fix works!
Scenario 2:
1. Build my env
2. Run Setup.exe to install from build
3. Run ARP from Start menu
4. Fix does not work!
Is Scenario 2 what you were talking about? If not, could you further explain? Thanks.
Question. I modified the OnMaintUIAfter, so my thought, not knowing too much about InstallShield, is that it will behave the same no matter where you run the setup.exe.
Having said that, I've tested this fix in many scenarios:
Scenario 1:
1. Build my env
2. Run Setup.exe to install from build
3. Run Setup.exe to uninstall from build
4. Fix works!
Scenario 2:
1. Build my env
2. Run Setup.exe to install from build
3. Run ARP from Start menu
4. Fix does not work!
Is Scenario 2 what you were talking about? If not, could you further explain? Thanks.
Posted 17 July 2002 - 02:14
Before I give you a long lecture on InstallShield or ask all these questions about your setup, it sounds like you always want to delete these files no matter what. In which case, simply add the code to OnBegin and be done with it.
If such is NOT the case, read on ...
OnMaintUIAfter will only be called for setups that have been applied and are subsequently re-ran. Typically this is through ARP, but it can also occur from the command line or Windows Explorer. Both scenarios you describe fit this criteria so you should be auto. calling this function.
That being said, what exactly did you add to OnMaintUIAfter and where. If you could simply post a copy of this code we can take things from there.
If such is NOT the case, read on ...
OnMaintUIAfter will only be called for setups that have been applied and are subsequently re-ran. Typically this is through ARP, but it can also occur from the command line or Windows Explorer. Both scenarios you describe fit this criteria so you should be auto. calling this function.
That being said, what exactly did you add to OnMaintUIAfter and where. If you could simply post a copy of this code we can take things from there.
Posted 18 July 2002 - 19:45
Thanks again for your help! Here is a copy of the first part of OnMaintUIAfter():
function OnMaintUIAfter()
NUMBER bvReturn, nvResult, getInfoResult, dResult1, dResult2;
STRING svProgramFilePath, svResult, szHDOCfile1, szHDOCfile2, szHDOCpath, szHDOCFullpath1, szHDOCFullpath2;
begin
if (bvRemoveInstall = FALSE) then
BuildBookMenu();
else //Check to see if the file c:\Program is created. Only occurs when uninstall of OLAP Server
//happens prior to uninstall of OLAP Miner.
szHDOCfile1 = "\\book0420.hdoc"; //Also, remove .hdocs and update bookmenu.
szHDOCfile2 = "\\book9970.hdoc";
szHDOCpath = svInstallPath + DOCS_DIR;
szHDOCFullpath1 = szHDOCpath + szHDOCfile1;
szHDOCFullpath2 = szHDOCpath + szHDOCfile2;
#ifdef DEBUG
WriteToDebugFile("szHDOCFullpath1 = " + szHDOCFullpath1);
WriteToDebugFile("szHDOCFullpath2 = " + szHDOCFullpath2);
#endif
dResult1 = DeleteFile(szHDOCFullpath1);
dResult2 = DeleteFile(szHDOCFullpath2);
#ifdef DEBUG
if (dResult1 = 0 && dResult2 = 0) then
WriteToDebugFile("Files deleted");
else
WriteToDebugFile("Files NOT deleted");
endif;
#endif
BuildBookMenu();
svProgramFilePath = "c:\\Program";
getInfoResult = GetFileInfo(svProgramFilePath,FILE_SIZE,nvResult, svResult);
if (getInfoResult = 0) then
if (nvResult = 0) then //File is of size 0 bytes
DeleteFile(svProgramFilePath);
endif;
endif;
endif;
The two files, book0420.hdoc and book9970.hdoc, are the files to be deleted. Also, we don't have an
OnBegin function in our environment.
function OnMaintUIAfter()
NUMBER bvReturn, nvResult, getInfoResult, dResult1, dResult2;
STRING svProgramFilePath, svResult, szHDOCfile1, szHDOCfile2, szHDOCpath, szHDOCFullpath1, szHDOCFullpath2;
begin
if (bvRemoveInstall = FALSE) then
BuildBookMenu();
else //Check to see if the file c:\Program is created. Only occurs when uninstall of OLAP Server
//happens prior to uninstall of OLAP Miner.
szHDOCfile1 = "\\book0420.hdoc"; //Also, remove .hdocs and update bookmenu.
szHDOCfile2 = "\\book9970.hdoc";
szHDOCpath = svInstallPath + DOCS_DIR;
szHDOCFullpath1 = szHDOCpath + szHDOCfile1;
szHDOCFullpath2 = szHDOCpath + szHDOCfile2;
#ifdef DEBUG
WriteToDebugFile("szHDOCFullpath1 = " + szHDOCFullpath1);
WriteToDebugFile("szHDOCFullpath2 = " + szHDOCFullpath2);
#endif
dResult1 = DeleteFile(szHDOCFullpath1);
dResult2 = DeleteFile(szHDOCFullpath2);
#ifdef DEBUG
if (dResult1 = 0 && dResult2 = 0) then
WriteToDebugFile("Files deleted");
else
WriteToDebugFile("Files NOT deleted");
endif;
#endif
BuildBookMenu();
svProgramFilePath = "c:\\Program";
getInfoResult = GetFileInfo(svProgramFilePath,FILE_SIZE,nvResult, svResult);
if (getInfoResult = 0) then
if (nvResult = 0) then //File is of size 0 bytes
DeleteFile(svProgramFilePath);
endif;
endif;
endif;
The two files, book0420.hdoc and book9970.hdoc, are the files to be deleted. Also, we don't have an
OnBegin function in our environment.
Posted 18 July 2002 - 23:20
Yeah, you may not already have an OnBegin function, but just use the drop down lists at the top of the InstallShield to insert into your code. Then just add the necessary DeleteFile code.