DO CASE CASE UPPER(OS())='WINDOWS NT' OR UPPER(OS())='WINDOWS 4' lcSection=IIF('NT'$UPPER(OS()),'Software\Microsoft\Windows NT\CurrentVersion',; 'Software\Microsoft\Windows\CurrentVersion') ThisForm.lblUserName.Caption=GETREGISTER(-2147483646,lcSection,'RegisteredOwner') ThisForm.lblUserCorp.Caption=GETREGISTER(-2147483646,lcSection,'RegisteredOrganization') OTHERWISE * Gets default user name, organization, and location of MSINFO.EXE from * WIN.INI (for Windows 3.x machines) * Gets default user name ThisForm.lblUserName.Caption=GETPROFIL('MS USER INFO','DEFNAME') * Get default corporation name ThisForm.lblUserCorp.Caption=GETPROFIL('MS USER INFO','DEFCOMPANY') ENDCASEThen, create those two functions or methods, whatever you like:
FUNCTION GetRegister * Return a value from a register * expN1 Key * expC1 Section * expC2 Entry PARAMETER tnKey,tcSection,tcString PRIVATE lnResult,lcBuffer,lnBufferSize,lnType,lcReturn lnResult=0 lcBuffer=SPACE(128) lnBufferSize=LEN(lcBuffer) lnType=0 lcReturn='' * First need to open the appropriate key IF RegOpenKeyEx(tnKey,tcSection,0,1,@lnResult)=0 * Read the value for the DLL entry IF RegQueryValueEx(lnResult,tcString,0,@lnType,@lcBuffer,@lnBufferSize)=0 * Strip off the junk at the end lcReturn=LEFT(lcBuffer,lnBufferSize-1) ENDIF ENDIF * Close the key =RegCloseKey(lnResult) RETURN lcReturn FUNCTION GetProfil * Return a value in an API mode * expC1 Section * expC2 Entry PARAMETER tcSection,tcString PRIVATE lcReturn,lcBuffer,lnBufferSize lcBuffer=SPACE(128) lnBufferSize=LEN(lcBuffer) lcReturn=GetProfileString(tcSection,tcString,'',@lcBuffer,lnBufferSize) lcReturn=LEFT(lcBuffer,lcReturn) RETURN lcReturn