HOWTO: Install a VFP6 Application for All User Access on NT 4 ServerID: Q231364
|
When installing an application from a routine created with the Visual FoxPro 6.0 Setup Wizard to a computer running Microsoft Windows NT Server, any program group that is created is only accessible to the current user (usually the ADMINISTRATOR or a member of the ADMINISTRATORS group). Using a post-setup executable, developers can move the program group from the current user's start menu to that of All Users, thereby ensuring that the application is accessible to all.
NOTE: The code in this article will work with Visual FoxPro version 5.0x as well. However, there is an issue with post-setup executables running on Microsoft Windows NT with that version. Please see the REFERENCES section below for more information on this problem.
There are three things to consider when doing this:
RESOURCE=OFF
SCREEN=OFF
LOCAL lcShortcutDir, lcTargetDir, lcProgGrpName
#DEFINE lnFile_Archive 32
#DEFINE lnFile_RO_Archive_Hidden 35
ON ERROR DO errhand WITH ERROR( ), MESSAGE( )
* Declare function to change file attributes on the file "MSCREATE.DIR"
DECLARE INTEGER SetFileAttributes IN "kernel32.dll" STRING lpFileName, INTEGER dwFileAttributes
* Set name of the program group created by the install program.
* MUST be the same as that given in Step 4 of the setup wiz for your application
lcProgGrpName = "My Test Program Group"
* Get directory where shortcuts were installed.
lcShortcutDir = GETENV('userprofile')+"\Start Menu\Programs" + "\" + lcProgGrpName
* Determine where shortcuts need to be moved.
lcTargetDir = GETENV('windir')+"\Profiles\All Users\Start Menu\Programs" + "\" + lcProgGrpName
SET SAFETY OFF
* Create new program group DIR in ALL USERS.
MD (lcTargetDir)
* Remove the Read Only & Hidden attributes from MSCREATE.DIR
SetFileAttributes(lcShortcutDir+"\mscreate.dir",lnFile_Archive)
* Copy application shortcuts.
COPY FILE lcShortcutDir + "\*.*" TO lcTargetDir + "\*.*"
* Reset the attributes on MSCREATE.DIR
SetFileAttributes(lcTargetDir+"\mscreate.dir",lnFile_RO_Archive_Hidden)
* Delete application shortcuts from source DIR so it can be removed.
DELETE FILE lcShortcutDir + "\*.*"
* Remove source DIR.
RD (lcShortcutDir)
SET SAFETY ON
RELEASE lcShortcutDir, lcTargetDir, lcProgGrpName
CLEAR DLLS
**************
#DEFINE MB_ICONINFORMATION 64 &&Information message
PROCEDURE errhand
PARAMETER merror, ErrMess
MESSAGEBOX ("The 'All Users' program group could not be created due to the following error:"+CHR(13)+CHR(13)+ ;
"Error number: " + LTRIM(STR(merror))+CHR(13)+ ;
"Error message: " + ErrMess,MB_ICONINFORMATION,"Program Group Error")
For additional information about using the Setup Wizard in Visual FoxPro 6, please see the following article in the Microsoft Knowledge Base:
Q194434 HOWTO: Use the Setup Wizard in Visual FoxPro 6.0For additional information about running post-setup executables under Windows NT from Visual FoxPro 5.0 Setup Wizard-created distribution files, please see the following article in the Microsoft Knowledge Base:
Q176887 FIX: Running VFP Exe as Post-Setup Executable Hangs the Process
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Trevor Hancock, Microsoft Corporation
Additional query words:
Keywords : kbwizard kbAppSetup kbNTOS400 kbVFp500a kbVFp600 kbGrpFox
Version : WINDOWS:5.0,5.0a,6.0; winnt:4.0
Platform : WINDOWS winnt
Issue type : kbhowto
Last Reviewed: July 20, 1999