Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Include file
Message
De
03/10/2007 16:44:53
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01258255
Message ID:
01258347
Vues:
13
>>I have a form that has an INCLUDE file. I added it through the Form menu. It does not seem to be working as the DEFINE values are not available in the INIT of my form during runtime.
>
>Just trying to figure out what is going on...
>When you say "not available" do you get an error?
>
>Could it be that something is being assigned to a variable in the INIT() then is out of scope in a method() in the class? If you want to use a 'stored' value it should be assigned to a property of the form.
>
>Can you show us a snippet of code in the INIT() where you think the issue might be occuring?
>
>-mike

Sure... The code is simplified for testing, but this is essentially it. This all works if it is contained in a single PRG, but once I went to the form, proc file and include file, it imploded.



Here is the Main Program:
ON SHUTDOWN QUIT
SYS(2340,1)

* TESTING ONLY
SET DEFAULT TO "c:\FMSDev\EMPS\"

SET PROCEDURE TO EMPS_Registry ADDITIVE 

DO FORM "EMPS_ADMIN"

READ EVENTS
QUIT
Then the form's INIT (note the ERROR comment):
* TESTING ONLY
* USE "c:\fmsrun\prompt\Ext_Prog.dbf" IN 0
* TESTING ONLY

oRegistry = NEWOBJECT("Registry","EMPS_Registry.fxp")


* ERROR is here, when the first constant, HKEY_LOCAL_MACHINE, is not found. Each constant defined in 
* the INCLUDE file after that is also not found.

	*** Now Read the values back
	THISFORM.HostName = oRegistry.ReadRegistryString(HKEY_LOCAL_MACHINE,;
		"SYSTEM\CurrentControlSet\Services\EMPS\Parameters",;
		"HostName")

	*** Now Read the values back
	THISFORM.Port = oRegistry.ReadRegistryString(HKEY_LOCAL_MACHINE,;
		"SYSTEM\CurrentControlSet\Services\EMPS\Parameters",;
		"Port")

	*** Now Read the values back
	THISFORM.BackupDirectory = oRegistry.ReadRegistryString(HKEY_LOCAL_MACHINE,;
		"SYSTEM\CurrentControlSet\Services\EMPS\Parameters",;
		"BackupDirectory")

	*** Now Read the values back
	 THISFORM.Switch = oRegistry.ReadRegistryString(HKEY_LOCAL_MACHINE,;
		"SYSTEM\CurrentControlSet\Services\EMPS\Parameters",;
		"Switch")


WITH THISFORM

	.txtHostName.CONTROLSOURCE = .HostName
	.txtPort.CONTROLSOURCE = .Port
	.txtDirectory.CONTROLSOURCE = .BackupDirectory
	.txtSwitch.CONTROLSOURCE = .Switch

	.VISIBLE = .T.

ENDWITH
And the INCLUDE file:
#DEFINE MAX_INI_BUFFERSIZE 256
#DEFINE MAX_INI_ENUM_BUFFERSIZE 16000

#DEFINE HKEY_CLASSES_ROOT           -2147483648
#DEFINE HKEY_CURRENT_USER           -2147483647
#DEFINE HKEY_LOCAL_MACHINE          -2147483646
#DEFINE HKEY_USERS                  -2147483645

#DEFINE ERROR_SUCCESS               0

#DEFINE REG_NONE					0
#DEFINE REG_SZ						1
#DEFINE REG_BINARY					3
#DEFINE REG_DWORD					4
#DEFINE MULTI_SZ					7
I'm not going to post the class definition code as it's a bit big and not really relevant for finding out why the constants are out of scope.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform