PDA

View Full Version : Running SB7 from within Clarion



Tom H.
07-22-2011, 03:40 PM
Hi!

Our switch from Wise to SB7 is now basically complete except for one more gotcha that we discovered today -- I hope you can help...

I have a small Clarion executable that we use as a front end menu for our install CD's. It provides information about the various products on the CD and allows the user to invoke setup for each of the individual packages (all are SB7, current release.) Each Setup.exe is in its own subfolder.

The Clarion statement is simple, e.g.,:

RUN('.\ChosenProgram\TheSB7Installer.exe',True)

This method worked fine for all Wise installs, but it just doesn't work with SB7 installs. If the exe is set to wait (Run() parm 2 = True), nothing happens (Win7) or else the app locks up (XP). Killing the process via Task Manager, the SB7 setup actually runs when the process terminates.

If I use parm 2 = False (don't wait), the SB7 setup does run as expected. This is not optimal, though, as the end user can now end up accidentally starting multiple instances of the installer, etc. from the menu program.

I've tried various manifest settings for the menu program, code signing it, etc., and none of it has any impact. Also tried C8 vs C6, same result.

Any ideas?

Thanks in advance,
Tom

linder
07-23-2011, 04:02 AM
Hi Tom,

I don't think that it is caused by the SetupBuilder app. Quite a few Clarion based programs make use of the wupdate.exe and/or wucheck.exe programs and they wait for it's termination without any problem.

The problem with RUN() in Clarion 6 is, that it is a wrapper around the CreateProcess Windows API. CreateProcess will always fail if a non-elevated application under Vista/2008/Win7 attempts to launch another application whose manifest requires elevation. GetLastError will return 740 (ERROR_ELEVATION_REQUIRED) in this case. In other words, you can't use the Clarion RUN() command with elevated setup.exe on UAC-aware operating systems. As far as I know, Clarion 8 fixes this. But you said that there is also a problem on XP, so...

If your app is a Clarion 6 program, then you have to use ShellExecuteEx. The following link provides a simple source code demo:

http://www.lindersoft.com/forums/showthread.php?p=44868&highlight=shellexecute#post44868
http://www.lindersoft.com/projects/ClarionShellExec.zip

What happens if you start your "TheSB7Installer.exe" with the above ShellExecute demo? Does it still not work? If it works okay then it is a Clarion issue. If it does not work as expected then it's a SetupBuilder problem <g>

Friedrich

linder
07-23-2011, 04:41 AM
BTW, and I bet that the following at the beginning of your script can "fix" the Clarion issue in your case:

Wait Dialog: Display "" [Thread]
Wait Dialog: Close

But I would not use the Clarion RUN() command at all in C6 because of the know CreateProcess issue.

Friedrich

Tom H.
07-23-2011, 12:49 PM
Thanks for the info, I'll look at the scripts/threads.

I have tried ShellExecute, with no joy. C8, also no joy. I'll double check that I tried ShellExecute in C8 (been trying a LOT of combinations...)

And on a side note, I've found that trying to Run() wupdate.exe at the end of my program doesn't work under Vista/7 either. (I do this when my own internal update checks show that there is an update available.)

I'll post back later on my results.

Thanks again,
Tom

Tom H.
07-23-2011, 09:00 PM
Good advice re C6.

Your example does run the SB7 setups under Win7, but I also get a 'security warning'. Do you have any suggestions for manifests, etc., to deal with something like that?

Also, your example code does not 'lock' the menu app like run('prog',true) would -- do I need to handle that myself via the detection code in the timer?

Thanks again for your help,
Tom

Tom H.
07-25-2011, 09:31 AM
Okay, I can use the timer and a flag to prevent another setup from being launched, so I think this will work for us. Thanks again for your help!

Tom