Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW TO WRITE IN ENTRY IN REGISTRY

Status
Not open for further replies.

remsor

Programmer
Joined
Nov 5, 2002
Messages
101
Location
PH
hello folks..

how do i write entry in registry...

thanks for any help...
 
remsor,
What kind of data do you want to write to the registry? The "standard" Registry class (and/or .PRG) that MS supplies, only allow you to write character strings. If you need to write dword or binary strings, I updated the files MS provides. Let me know if you need this capability.

Rick
 
Rick,
Thanks if you can send me your updated class and can you send sample code on how to do it.. i need this to protect my software from copying and install in another pc... i need to write at the registry and read the license of t\my software. my email ad: remsor@yahoo.com. thanks a lot..
 
Here is a function I use to create registry entries. I think I based it on one I found in Foxpro Advisor. I use it to initialize PDF filenames, so I set the parameter defaults for that purpose. You can remove or replace the code that initializes missing parameters.


*====================================================================
FUNCTION SetRegValue(cRegKeyVal, cRegFolder, cRegKeyName) && Assign a registry key value
* Syntax: nResult = SetRegValue(cRegKeyVal, cRegFolder, cRegKeyName)
* Parameters: (required) cRegKeyVal - Key value to post
* (optional) cRegFolder - Folder containing key
* (optional) cRegKeyName - Key name
* Notes: 1. Uses REGISTRY.PRG
* 2. Customized for setting PDF filename, but will set any key
* Returns: nResult - Numeric error# from SetRegKey() - 0=Success
*====================================================================

#define REGFILE "K:\VFP\Lib\registry.prg" && Registry library
#DEFINE HKEY_CURRENT_USER -2147483647 && BITSET(0,31)+1
LOCAL oReg,nErrNum
IF !FILE(REGFILE)
MESSAGEBOX("SETREGVALUE: The required file "+REGFILE+" could not be found.")
RETURN
ENDIF
if type(&quot;cRegKeyVal&quot;) <>&quot;C&quot;
MESSAGEBOX(&quot;SETREGVALUE: The required key value parameter is missing&quot;)
RETURN
ENDIF
* Parameters
cRegFolder = iif(type(&quot;cRegFolder&quot;) ==&quot;C&quot;,cRegFolder ,&quot;Software\Adobe\Acrobat PDFWriter&quot;)
cRegKeyName = iif(type(&quot;cRegKeyName&quot;)==&quot;C&quot;,cRegKeyName,&quot;PDFFileName&quot;)
oReg = NewObject(&quot;FoxReg&quot;,REGFILE) && Create registry object
return oReg.SetRegKey( cRegKeyName , ;
cRegKeyVal , ;
cRegFolder , ;
HKEY_CURRENT_USER)

Mike Krausnick
 
remsor,
It's on it's way.

Rick
 
mkrausnick,

thank you so much..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top