Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the User and Company Name
Message
 
To
10/05/2001 11:29:30
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00505632
Message ID:
00507208
Views:
21
Michel,

Are you sure this will work?

OS() returns 'WINDOWS 5.00' on my Win2K pro machine, so the first case statement won't fire - OTOH, there's no MS USER NAME section in the win.ini file either, so the OTHERWISE statement's not much good.

Perhaps it needs a check added for WINDOWS 5 in the first case statement.

You'd also need to be careful of SET EXACT.

Cheers,

Andrew

>>I would like to know if it is possible to get the
>>user and company that windows is registered to
>>as shown in the My Computer properties screen.
>>
>>
>>Does anybody know if there is a function to do this?
>
>In the Init() of the form, try:
>
>
>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')
>
>ENDCASE
>
(snip)


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform