Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Class in PRG vs class in VCX
Message
De
17/05/2021 11:55:12
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01680487
Message ID:
01680502
Vues:
47
>Hi,
>
>I am wondering if it is a better practice to have the class defined in a PRG file or VCX file? Note that I don't care about the speed. All I care is about how VFP uses the class. Let me explain what I mean by "uses" (because I don't know how).
>
>In my application there is a class PASSWORD defined in a PRG file. It has several methods and a number of properties. This class is instantiated at the top of the application and the reference is a PUBLIC variable oPassword. Again, it is not important that this is a public variable. I can easily make it into a property of the application object/class. But I think, at this point, it is not important.
>
>This class PASSWORD works for 99% of the customers without any problems. But I have a customer (I already have a couple of threads about issues the application has there) that has the following problem.
>
>Sometimes (rare but sometimes) when a method of the class PASSWORD is used (e.g. oPassword.passcode( ### ), the program bombs with the message "cannot find the file c:\users\.......\password.fxp"
>Interesting that at exactly the same time the application loses connection to the SQL Server (because I keep a log of these issues). But using the code suggested by Walter Meester, the SQL Server connection is restored ON THE FIRST trial. Which is great. But I don't know how to restore the application connection to the VM share where the application reside. Therefore, I have two questions:
>
>1. If the class PASSWORD is refactored into a VCX file, do you think it will be more stable?
>2. My understanding is that the entire application (it is about 17MB in size) is loaded into the PC memory when the application starts. Therefore, the application should not really "go back" to the VM share to get some code. Because the code is all inside the APPL.EXE file and therefore in the memory of the PC.
>What then "wipes" the code from the PC memory that the application needs to "go back" to the share?
>
>TIA.

By default, VFP searchs for disk files before searching the application.
It impacts performance and also is a security risk.

Call sys(2450,1) at startup to prevent vfp from looking for external files,
or use "set procedure to myfile.prg"

Check help file on this topic.
@nfoxdev
github.com/nfoxdev
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform