Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Frustrated with our VFP program under Vista 3

Status
Not open for further replies.

vfp7guy

Programmer
Jul 2, 2002
45
CA
We've been tearing our hair out over this one. Because we are a VFP9 shop, I hope that this is the appropriate forum for posting this one, even though the problem is only with clients running Vista.

Our distributed multi-user package has an Auto-Update feature that allows downloading and/or installing of updates from our website. These 2 features are based on the client's current version being compared to a version-control sequence.dbf that ensures that updates are installed sequentially. Our system has used this process for several years now. But, we have a major problem running this specific function on Vista.

The actual self-extracting EXE (created using Package For The Web) is downloaded into a /ServicePacks subdirectory, along with some control files. When selected within our menu system for installation, (after a series of validations and tests that all users are locked out), the program executed these 2 commands sequentially:

&UpdFileName
QuitProg()

Public variable UpdFileName is the RUN command including the full path to the self-extracting EXE in the \Servicepacks subdirectory, such as:
"RUN /N servicepacks\SP_A20070301.EXE"
QuitProg() immediately does a clean exit from our system.

The self-extracting EXE would launch, perform the proper expansion/replacement, then exit to launch the replacement "... update completed for version xxxxx..." program. This always works under pre-Vista systems.

Under Vista, all goes well except the SP_A20070301.EXE doesn't launch.
I replaced the RUN command with code using WinExec() ... also tested using CreateProcess(). Same results.

If I manually enter the WinExec code from the VFP commandline, or run the code manually in a .PRG, Vista will open the "...unknown publisher..." window, with the option of running or cancelling. If RUN is selected, everything goes properly to completion. If I take this .PRG and compile it into a VFP EXE, and run the EXE from the VFP commandline, I get the same behaviour ... I get the option to run or cancel. However, if I run this EXE from MyComputer or Explorer in Vista, nothing gets run ... I do not get the Vista "...unknown publisher..." window.

I have tested with WAIT windows showing WinExec's returncodes. I expect a 33 showing successful launching as in WinXP and others. I get the 33 when run from inside VFP, but only after I respond positively to the Run Anyway option. When the EXE is run from MyComputer, the returncode is 0 (not really a valid returncode for WinExec).

What am I missing here? I thought maybe some DLL available inside VFP that WinExec or CreateProcess uses that is not included in our runtime modules, but we have other uses of these functions that work.

Is it related to the EXE from Package for the Web? I played around with compatibility settings with no success.
Anybody have any idea?
 
Because SP_A200703001.EXE looks like an installer or updater to Vista, it requires elevation. However, the RUN command fails when calling an EXE that requires elevation if your VFP EXE wasn't run as administrator.

The solution is to use ShellExecute instead with "RunAs" as the parameter. The user will be prompted to elevate if they're a standard user or confirm if they're an administrator, but once they've done that, the EXE will execute. See for more details.

Doug
 
Doug,

That is very helpful and a salient warning to me, as I'm shortly going to be testing my apps on Vista - and I can see that the autoupdate feature will need some 'tweaking'.

Have a star

Regards

Griff
Keep [Smile]ing
 
Griff (and others),

Doug has also written a couple of very informative articles in Advisor Guide to VFP, dealing with many aspects of Vista. I recomment you read them. The first is at:

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks Mike,

That is a very useful article, I can see that migrating to Vista is going to be no small thing - and that my 'NightWatchman' applications are going to be particularly tricky...

B-(

Regards

Griff
Keep [Smile]ing
 
Thanks Doug for the valuable input and link. A star for sure. I will be trying this change this morning and will let you all know the results.

Any job worth doing is worth doing right!
 
Thanks again all of you for the valuable input. I followed Doug's suggestion with ShellExecute and the Vista users now get the UAC prompt to Allow/Disallow. Great.

I spent much of the morning following your links to much of the VFP<->Vista relationship. There's a lot to consider, not only in ongoing development, but also in retesting all existing functions for variations in Vista UAC settings. With the likelihood of mor migration to Vista, I think many developers will need to be involved in this aspect.
Again ... thanks all,
Roy


"Any job worth doing is worth doing right!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top