Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Location
    ND, USA, Earth
    Posts
    12

    Grin Populating User Information screen

    I have been trying to populate the User Information screen after I write that information to a specific registry spot.. but with no luck.

    I use the code below to write in the Shutdown section ..

    Code:
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Metal Building Software", "User",
    					SessionVar.Expand("%UserName%"), REG_SZ);
    
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Metal Building Software", "Company",
    					SessionVar.Expand("%UserCompany%"), REG_SZ);
    And the code below to populate the user form.. tried to add this code to the Actions of the User Information screen in the Before Installing section.. but ended up adding to Startup

    Code:
    --
    -- load edit fields with information from registry if present
    --
    -- User name
    
    if Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\Metal Building Software") then
    
    	tmp = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Metal Building Software", "User", false);
    	
    	SessionVar.Set("%UserName%", tmp);
    
    --
    -- Company name
    --
    
    	tmp = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Metal Building Software", "Company", false);
    	
    	SessionVar.Set("%UserCompany%", tmp);
    	
    end;
    Am I go about this all wrong? If anyone has a better mouse trap.. please let me know

  2. #2
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    Forgot to escape the backslash in Registry.DoesKeyExist() and Registry.GetValue()? Also, you are setting the keys in HKCU and reading from HKLM ... perhaps using a single location would work better.

    Ulrich

Tags for this Thread

Posting Permissions

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