INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Classes and Objects

How to subclass classses by mgagnon
Posted: 7 Sep 02 (Edited 2 Nov 02)

This code will subclass all the classes locate in a given directory, for example:( Home()+"wizards" )


LOCAL lcSourcePath AS STRING , lcTargetPath AS STRING,lnVCXCount AS INTEGER
LOCAL ARRAY laVCX(1)

lcSourcePath = "C:\Program Files\Microsoft Visual FoxPro 7\WIZARDS"
lcTargetPath = "E:\VFP-Projects\A1-FD-Library\WIZARDS"
lcSourcePath = GETDIR(lcSourcePath, "", "Select the Class Librairies Input Directory")
lcTargetPath = GETDIR(lcTargetPath, "", "Select the Class Librairies Output Directory")

lnVCXCount = ADIR(laVCX, ADDBS(lcSourcePath) + "*.VCX")

FOR lnVCXNo = 1 TO  lnVCXCount
    ERASE (ADDBS(lcTargetPath) + JUSTSTEM(laVCX(lnVCXNo,1))+".vcx")
    ERASE (ADDBS(lcTargetPath) + JUSTSTEM(laVCX(lnVCXNo,1))+".vct)
    USE (ADDBS(lcSourcePath) + JUSTSTEM(laVCX(lnVCXNo,1))+".vcx") ALIAS VCX SHARED
    && Shared required on USE to avoid a "file in use" error.
    SELECT * FROM VCX ;
        WHERE !EMPTY(TimeStamp) AND EMPTY(Parent) AND NOT EMPTY(ObjName) ;
        INTO CURSOR TEMP
    USE IN VCX
    EXTRACTCLASSES(ADDBS(lcSourcePath) +JUSTSTEM(laVCX(lnVCXNo,1))+".vcx", ;
                   ADDBS(lcTargetPath) + JUSTSTEM(laVCX(lnVCXNo,1))+".vcx")
    USE IN TEMP
ENDFOR


********************************************************
PROCEDURE EXTRACTCLASSES
    LPARAMETERS lcSourceClassLib, lcTargetClassLib
    SELECT TEMP
        SCAN  
        CREATE CLASS (ALLTRIM(TEMP.objname)) ;
            OF (lcTargetClassLib) ;
            AS (ALLTRIM(TEMP.objname)) ;
            FROM (lcSourceClassLib) ;
            NOWAIT
        IF WVISIBLE("Properties")
            RELEASE WINDOW ("Properties")
        ENDIF
        INKEY(.1)
        SYS(1500,"_mfi_save","_mfile")
        INKEY(.1)
        SYS(1500,"_mfi_close","_mfile")
        INKEY(.1)
        SET CLASSLIB TO
    ENDSCAN



Original code by Francois Dinel and modified by Mike Gagnon

Mike Gagnon


Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close