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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I store and update data buat not at database?

Status
Not open for further replies.

paispatin

Technical User
Oct 21, 2003
62
A1
Dear all,

I just curious about putting some setting/product version/company name at a file but that file can not read with notepad or not a database file (such as dbf).

This is the sample situation:
I create a master program and compile at .exe.
Inside the master program, there is copyright for a company name, but I want company name can be change without do it at visual foxpro 8 program, just doing something, maybe create a new .exe program special only for changing a company name at that program.

Just curious
Thank you in advance.
 
paispatin

You could store this information in the Windows registry, and retrieve this information when the application loads.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
While the Registry is the current prefered method, you could revert to what we did in the "old" days and write it to a .INI text file. Then all you need is Notepad to change the data.

Rick
 
Thank you for reply, Mike Gagnon to write at Registry maybe such a good idea, but how to do that. I mean the simple script for write and read the registry. Even if we use WinXP or W2K it will be difficult for standart user for edit the registry unless the administrator give privilege for him.

Mike Lewis and Rick, if I put the client company name who use that program at a flat file even we could hide it, it still easy for someuser to find that file, and change the company name than make that program copright to other company.

Craig, I don't have idea how to use XML.

Thank you
 
What version of VFP are you in?

If you're in v6,7 or 8, it's really simple to create a (slightly) encrypted text file that stores the company name:

To store the name:
Code:
lcClean = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
lcEncr = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'
lcCompanyName = "My Company"
lcEncrypted = CHRTRAN(lcCompanyName,lcClean,lcEncr)
STRTOFILE(lcEncrypted,'MyAPP.KEY')

* to retrieve the name:
lcEncrypted = FILETOSTR('MyAPP.KEY')
lcCompanyName = CHRTRAN(lcCompanyName,lcEncr,lcClean)

You can come up with a stronger encryption mechanism if you want, but how much effort (and how many people) will people go through to pirate your application?

BTW: If you don't want people using Notepad to change your registered company name, be sure to consider that opening RegEdit and using "Find" to locate the company name (in case you put it in an unusual place) isn't very hard either.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
As an additional idea, using the above method, if you CHRTRAN to a string composed of CHR(1)...CHR(52), then anyone would have a real hard time editing the encrypted file with notepad: they'd need a hex editor to change the chars that are in the low ascii range.

ie:


lcEncr = ''
for lnI = 1 to 52
lcEncr = lcEncr + chr(lnI)
endfor

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
If you're just creating a flat file XML, you can use CURSORTOXML() and XMLTOCURSOR(). XML is simply a text file with special tags to delimit the data.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top