在VFP中获取Windows注册信息的方法
Error = RegQueryValueEx(Result, "RegisteredOrganization", Reserved, ;
@Type, @OutBuffer, @BufferSize)
IF Error = 0 AND OutBuffer <> CHR(0)
OutCompany = LEFT(OutBuffer, BufferSize - 1)
ENDIF
ENDIF
=RegCloseKey(Result)
OTHERWISE
*-- 系统为Windows 3.X 版本
OutRetVal = GetProStr("MS USER INFO", "DEFNAME", "", @OutBuffer, BufferSize)
OutUser = LEFT(OutBuffer, OutRetVal)
OutRetVal = GetProStr("MS USER INFO", "DEFCOMPANY", "", @OutBuffer,BufferSize)
OutCompany = LEFT(OutBuffer, OutRetVal)
ENDCASE
If Error = 0
=MessageBox("用户:" + OutUser + Chr(13) + "单位:" + OutCompany)
Else
=MessageBox("未找到用户及单位。")
Endif
《在VFP中获取Windows注册信息的方法(第3页)》