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

How to show company and name 1

Status
Not open for further replies.

Germancho

Programmer
Jul 9, 2003
36
I´m doing a generic accounting application and I need to retrieve the company name and the person`s name from the window registry and then show it in the intro form. How can I do that?
 
Here is a simple example where I get the registered user and company name. Note: The registry.PRG and .VCX work almost exactly the same. (Just change SET PROCEDURE TO (m.lcRegfile) ADDITIVE to SET CLASSLIB TO (m.lcRegfile) ADDITIVE, and RELEASE PROC (m.lcRegfile) to RELEASE CLASSLIB (m.lcRegfile).)
Code:
*usage example
STORE "" TO lcRegName, lcRegCompany
= get_syslicense(@lcRegName, @lcRegCompany)
...

* Program....: GET_SYSLICENSE.PRG
* Version....: 1.0
* Author.....: ** Richard G Bean **
* Date.......: April 2, 1999
* Compiler...: Visual FoxPro 05.00.00.0415 for Windows

PARAMETERS p_cRegName, p_cRegCompany
LOCAL lcRegfile, oReg

STORE "" TO p_cRegName, p_cRegCompany

m.lcRegfile = "REGISTRY"
SET PROCEDURE TO (m.lcRegfile) ADDITIVE
oReg = CreateObject("Registry")

oReg.GetRegKey("DefName",@p_cRegName,;
   "Software\Microsoft\MS Setup (ACME)\User Info",oReg.nUserKey)
oReg.GetRegKey("DefCompany",@p_cRegCompany,;
   "Software\Microsoft\MS Setup (ACME)\User Info",oReg.nUserKey)
RELEASE PROC (m.lcRegfile)

IF EMPTY(p_cRegName)
   p_cRegName = "(Unknown)"
ENDIF && EMPTY(p_cRegName)
IF EMPTY(p_cRegCompany)
   p_cRegCompany = "(Unknown)"
ENDIF && EMPTY(p_cRegCompany)

RETURN .T.

*!* EOP: GET_SYSLICENSE.PRG
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top