Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to send mails with files attachment from vfp
Message
 
To
16/03/2009 00:12:19
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01344536
Message ID:
01388583
Views:
61
>Hi again, Yes please can you email me the registry settings and also now the function is looking for "Blatmail.prg" which can't be found.
>Once I get this going, I shall be good as gold. Thanks again.
>Shafif

BLATMAIL.PRG is that entire class. Make a PRG called BLATMAIL and stuff the entire class definition in it.

Here is RegistryInterface.prg - this is my registry class...make a PRG called registryinterface.prg and stuff the following class definition in it..
***********************************************
DEFINE CLASS RegistryInterface as CUSTOM
***********************************************

*!*	Usage examples..

*!*	Instantiate..
*!*	test = NEWOBJECT("registryInterface","registryinterface.prg")

*!*	RETURN value of reg_SZ 'Sender' in HKLM\software\Public Domain\Blat\
*!*	?test.check_registry_value("Sender","software\Public Domain\Blat")
*!*	returns value or a 'KGNOsomething' error code

*!*	SET value of reg_SZ 'Sender' to "bkuhn@examinetics.com" in HKLM\software\Public Domain\Blat\
*!*	NOTE: This will create the entire key if it doesn't exist
*!*	test.set_registry_value("Sender","bkuhn@examinetics.com","software\Public Domain\Blat")
*!*	returns .T. (success) or .F.

	#if .f.
		LOCAL this as RegistryInterface OF registryinterface.prg
	#endif


	icProgramRegistryKey	=	''  && this is the registry path under HKLM i.e. "software\microsoft\Office\Word"

	inHKEY_LOCAL_MACHINE	=	-2147483646  && -2147483646 is HKEY_LOCAL_MACHINE
	inHKEY_CLASSES_ROOT		=	-2147483648
	inHKEY_CURRENT_USER		=	-2147483647
	inHKEY_USERS			=	-2147483645
	inCurrent_Key			=	0
	

	oReg = .NULL. 

	**********************************
	FUNCTION INIT
	**********************************
	
		this.inCurrent_Key = this.inHKEY_LOCAL_MACHINE  && specify numeric key for something else if you need..
		
		this.oReg = NEWOBJECT('registry','registry.vcx')

	
	RETURN  && INIT
	
	**********************************
	ENDFUNC  && INIT
	**********************************

	**********************************
	FUNCTION set_registry_value
	**********************************
*!*	this function sets the value of this.inCurrent_Key\pcKey\pcRegistryValueName	
	PARAMETERS pcRegistryValueName,pcNewValue,pcKey

		local llRetVal
		local lcValue

		llRetVal = .F.  && default return value 
		lcvalue = SPACE(260)


		IF !(this.oReg.IsKey(pcKey,this.incurrent_Key))  && is there a key at all?
			this.oReg.Openkey(pcKey, this.inCurrent_Key, .T.)  && create the key
		endif

		this.oReg.Openkey(pcKey, this.inCurrent_Key, .F.)

		IF this.oReg.SetKeyValue(pcRegistryValueName,pcNewValue) <>0  && set the new value
*!*				MESSAGEBOX('Unable to set registry value '+pcRegistryValueName)
		ELSE
			llRetVal = .T.
		endif

		this.oReg.Closekey()


	RETURN  llRetVal && set_registry_value
	
	**********************************
	ENDFUNC  && set_registry_value
	**********************************


	**********************************
	FUNCTION Check_Registry_Value
	**********************************
*!*	this function returns value of this.inCurrent_key\pcKey\pcValueToCheck
	PARAMETERS pcValueToCheck,pcKey

		local llRetVal
		local lcValue
		
		IF EMPTY(pcValueToCheck)
			RETURN 'KGNOVALUETOCHECK'
		ELSE
			pcValueToCheck=TRIM(pcValueToCheck)
		ENDIF
		
		IF EMPTY(pcKey)
			RETURN 'KGNOKEYSPECIFIED'
		ELSE
			pcKey=TRIM(pcKey)
		endif

		llRetVal = .F.  && default return value - DebugMode is OFF
		lcvalue = SPACE(260)

		IF INLIST(LEFT(pcKey,1),'\','/')
			pcKey = substr(pcKey,2)
		ENDIF
		
		IF INLIST(right(pcKey,1),'\','/')
			pcKey = substr(pcKey,1,LEN(pcKey)-1)
		ENDIF
		

		IF !(this.oReg.IsKey(pcKey,this.inCurrent_Key))  && is there a key at all?
			lcValue='KGNOKEYFOUND'
*!*				this.oReg.Openkey(pcKey, lnHKEY_LOCAL_MACHINE, .T.)  && create the key

		ELSE
		
			this.oReg.Openkey(pcKey, this.inCurrent_Key, .F.)

			IF this.oReg.GetKeyValue(pcValueToCheck,@lcValue) <> 0 && failed to check value
			  lcValue='KGNOVALUEFOUND'
			endif
		
		endif


		this.oReg.Closekey()

	RETURN  TRIM(lcValue) && check_registry_value
	
	**********************************
	ENDFUNC  && check_registry_value
	**********************************
	
***********************************************
ENDDEFINE  && registryinterface
***********************************************
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform