Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Build project from generic project
Message
De
27/03/2003 23:38:05
 
 
À
27/03/2003 11:01:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00770771
Message ID:
00771171
Vues:
22
For anyone who is curious, here's some sample code to do this:

Create a projects.dbf with fields InstallDir (where the resulting exe will be created), SourceDir (where the files specific to the individual project are), ExeName, Icon, Recompile (flag to build the exe for this record or not). Put the dbf in a subdir with the generic project (genericproj) and the program below.
*-- program to create executables from data in projects.dbf
LOCAL lcSourceDir, lcInstallDir, lBuild

SELECT 0
USE Projects
SET FILTER TO recompile 
modify project genericproj nowait save noshow noprojecthook
IF type("_vfp.activeproject") = "O" then
   SCAN
      lcSourceDir = ALLTRIM(Projects.SourceDir) + "\"
      lcInstallDir = ALLTRIM(Projects.InstallDir) + "\"
      WITH _vfp.ActiveProject
         *-- change the icon
         .Icon =  lcSourceDir + ALLTRIM(Projects.Icon) + ".ico"

         *-- main menu may differ between programs so delete it and add the  appropriate one
         *--find the mainmenu and remove it
         FOR EACH loFile IN .Files
            IF UPPER(RIGHT(loFile.Name,12)) = "MAINMENU.MNX" THEN
               loFile.Remove()
            ENDIF
         ENDFOR
         *-- add in appropriate menu
         .Files.Add(lcSourceDir + "MainMenu.mnx")
         *-- include the menu in the project
         .Files("MainMenu.mnx").Exclude = .F.
         
         *-- rebuild the project
*         Object.Build([cOutputName] [, nBuildAction] [, lRebuildAll] [, lShowErrors] [, lBuildNewGUIDs])
         *nBuildAction = 3 to build exe
         lBuild = .Build(lcInstallDir + ALLTRIM(Projects.ExeName), 3, .f., .t.)
      ENDWITH
      IF lBuild THEN
         ?"Rebuilt " + ALLTRIM(projects.exename)
      ELSE
         ?"Problem building " + ALLTRIM(projects.exename)
      ENDIF   
   ENDSCAN   
ENDIF
>I have approx 30 software products built on the same basic engine using VFP6. Each of these has a project however the projects are very similar. The only differences between them are the icons and the menus. I have removed the data from the projects. I want to be able to base all the 30 programs on one project and build all 30 executables by running a vfp program. This program will need to change the icon and the menu location for each project and name the executable a different name. Has anyone done this programmatically? The idea is that I will only have to maintain 1 project and any changes to that project will be propogated thru all other projects when the exes are rebuilt. I have toyed with changing name, key, homedir, etc in the pjx table but some items like menus appear to need adding thru the interface so their object code, etc are updated correctly in the pjx.
>
>Any help would be great! Thanks.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform