Results 1 to 2 of 2

Thread: windows user name --> change....

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    chicago (hope)
    Posts
    146

    Unhappy

    i want to change the username (that i entered when installing windows) WITHOUT reinstaling....

    does anybody know help..???


    thanx

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'Change the registered owner and user names on a pc
    
    'Add the following code to a module.
    'remember, you are playing with the registry...
    'what happens happens at your own risk
    '
    '
    Option Explicit
    
    Public Const HKEY_LOCAL_MACHINE = &H80000002
    '
    Declare Function RegCreateKey Lib _
    "advapi32.dll" Alias "RegCreateKeyA" _
    (ByVal Hkey As Long, ByVal lpSubKey As _
    String, phkResult As Long) As Long
    
    Declare Function RegCloseKey Lib _
    "advapi32.dll" (ByVal Hkey As Long) As Long
    
    Declare Function RegSetValueEx Lib _
    "advapi32.dll" Alias "RegSetValueExA" _
    (ByVal Hkey As Long, ByVal _
    lpValueName As String, ByVal _
    Reserved As Long, ByVal dwType _
    As Long, lpData As Any, ByVal _
    cbData As Long) As Long
    
    Public Const REG_SZ = 1
    Public Const REG_DWORD = 4
    
    Public Sub savestring(Hkey As Long, strPath As String, _
    strValue As String, strdata As String)
    	Dim keyhand As Long
    	Dim r As Long
    	r = RegCreateKey(Hkey, strPath, keyhand)
    	r = RegSetValueEx(keyhand, strValue, 0, _
    	REG_SZ, ByVal strdata, Len(strdata))
    	r = RegCloseKey(keyhand)
    End Sub
    
    '<<<<<<  Code for event command button  >>>>>>
    
    Private Sub Command1_Click()
    
    'Prompts for the new name of the Registered Organization
    	strOrganization$ = InputBox("Organisation:")
    	
    	If strOrganization$ = "" Then
    		MsgBox "Empty String", vbCritical, "Error"
    		Exit Sub
    	End If
    
    'Saves string (Organization) to the registry
    	Call savestring(HKEY_LOCAL_MACHINE, _
    	"Software\Microsoft\Windows\CurrentVersion", _
    	"RegisteredOrganization", strOrganization$)
    
    'Prompts for the new name of the Registered Owner
    	strOwner$ = InputBox("Owner:")
    	If strOwner$ = "" Then
        		MsgBox "Empty String", vbCritical, "Error"
        		Exit Sub
    	End If
    
    'Saves string (Owner) to the registry
    	Call savestring(HKEY_LOCAL_MACHINE, _
    	"Software\Microsoft\Windows\CurrentVersion", _
    	"RegisteredOwner", strOwner$)
    
    End Sub
    
    
    'To see the result go to Control Panel / System / General.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width