Question about user name

Babscoole
2007-09-29
2013-03-26
  • Babscoole

    Babscoole - 2007-09-29

    I was taking a quick look at your program and really like it.  One thing I was wondering though.  When the program starts, in the login user details pop-up, the section labelled as User Name is populated with the machine name.  Wouldn't it be better to populate the field with the name of the currently logged in user?

     
    • GremlinSA

      GremlinSA - 2007-11-07

      I guess this is a good point... In early development (Win 98 - VB5), it was easier to get the machine name from winsock, rather than add additional code to get the Logged in user name...

      I'll add this to the list of future additions...

       
    • Babscoole

      Babscoole - 2008-01-30

      Thanks.  Figured I'd pop in and see how the program is coming along.

       
    • Babscoole

      Babscoole - 2008-02-04

      I should preface by saying that I'm not a programmer.  I do use VBScript, but haven't messed with "true" programming since Basic in the late 70's.

      I downloaded the free Visual Basic 2008 Express IDE to play with your source code and see what kind of damage I could do.  :)

      Began with your VB6 version, but had to track down some ocx files for it to convert.  Once I got those and the project converted, there were dozens of issues, so decided to try out the beta of your .net version.

      Changed a couple of lines to get the username thing to work.  In UserInfo.vb, I made Private mvarUserName As String = Environment.UserName.  Also had to add this in Public Sub Load (), mvarUserName =  to make it (rk.Getvalue("UserName", Environment.UserName), String).  I also changed the properties for the User Name box on the login page to Read Only.   

      With that done, started doing a little testing with my changes.

      On XP, things seem to work great.  With Vista, ran into a few problems.  The first one was errors reading the registry.  I knew this had to do with UAC not being invoked.  I went to the project properties and under appliaction, I found a button called View UAC Settings.  This took me to app.manifest.  It had some commented instruction for how to run file and registry in virtualized mode for legacy compatibility, so I did what it said and commented out requestExecutionLevel.  Seems to work quite nicely.

      The other VIsta issue has to do with IPv6 being enabled by default.  On the login page, the IP Address dropdown list orders IPv6 addresses to the top of the list, which could be very disconcerting to an end user.  Is there some way to change the ordering so that the "main" IPv4 address will be the first choice on an IPv6 enabled system, like it is on a IPv4-only system? 

       
    • Babscoole

      Babscoole - 2008-02-04

      More playing around, lol.

      Figured out a temporary solution to the IPv6 thing, thanks to google and some sample code from 4guysfromrolla.com.  Basically, I've found a way to skip IPV6 addresses altogether.  Probably want some way to reorder the list as mentioned above, as IPv6 usage will start taking off in the next couple of years.

      In Network Functions.vb, under Imports System.Net in the Public Function GetLIPAddresses() As ArrayList section, I added an If Then around the IPList.Add.

      If address.Address.AddressFamily.ToString() = "InterNetwork" Then
      IPList.Add(address.Address.ToString)
      End If

      Now, with that in place, only IPv4 addresses will display in the Local IP list on the login page.  Still have a minor issue with ordering of the list.  In my case, on a vista laptop, it shows 3 IPv4 addresses.  Top:  APIPA (169.254.x.x) address for the disconnected wireless adapter, Middle:  192.168.x.x address for the local LAN wired adapter (this is the one I want to be the top of the list, Bottom:  127.0.0.1 Local Loopback which is fine where it is.

       
    • Babscoole

      Babscoole - 2008-02-07

      Made another change to resolve this issue.  Decided to just stick with IPv4 and only for my local Lan subnet which solves the ordering issue, since only one IP will be valid.

      In NetwokFunctions.vb, under GetLIPAddresses, I modified the function to read:

          Public Function GetLIPAdresses() As ArrayList
              Dim NetInterfaces() As NetworkInformation.NetworkInterface = NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
              Dim IPList As New ArrayList
              Try
                  For Each NetInterface As NetworkInformation.NetworkInterface In NetInterfaces
                      Dim infosDns As NetworkInformation.UnicastIPAddressInformationCollection = NetInterface.GetIPProperties.UnicastAddresses
                      For Each address As NetworkInformation.UnicastIPAddressInformation In infosDns
                          If address.Address.AddressFamily.ToString() = "InterNetwork" Then
                              If address.Address.ToString Like "192.168.1.*" Then
                                  IPList.Add(address.Address.ToString)
                              End If
                          End If
                      Next
                  Next
              Catch ex As Exception
                  MessageBox.Show("Error: " & ex.Message)
              End Try
              Return IPList
          End Function

       
    • GremlinSA

      GremlinSA - 2008-09-05

      Thanks for posting all this info ..

      The Last 6 months have been hell at work, I have a hugh project that is just slipping further and further back on the timetable.. I'm hoping to spend time on this and other projects sometime in Nov / Dec ...

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks