Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 13 of 13
  1. #1
    Join Date
    Jan 2007
    Posts
    160

    Get Computer Name?

    How can I get the computer name on which my AMS browser is running? Do I have to use GetLANInfo or is there another way?

    I have to determine if the computer name contains "_" (underscore) with String.Find, I guess. If so, I need to warn the user that our Web application may not work properly with an underscored system name (why, I have no idea - that's for the hardcore developers to figure out). Then I guess I'll kill the app or do whatever I am directed to do by the decistion makers at that point.

    Any help appreciated.

  2. #2
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    yes you need to use getlaninfo,
    as far as checking for an underscore in the return you can use string.find with some regex or you can use my free RegXmATCH.dll which is posted under ams7 discussion [also works for ams6] as it allows you to perform a regex match on any givin text.

  3. #3
    Join Date
    Jan 2007
    Posts
    160
    Here's what I came up with since my initial post:

    tblHost = System.GetLANInfo();

    strfound = String.Find(tblHost.Host, "_", 1, false);

    if strfound >= 1 then

    --underscore found
    Dialog.Message("Problematic Server Name...", "The system on which you are trying to install Our App contains an underscore (_) in the system name.\r\nOur App will not function properly under this condition. The system's IP address must be used!", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    --May have to do something else here...

    end

    Does anyone see any pitfalls or should this do the trick?

  4. #4
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    that should work fine. quick question though why would an underscore cause a problem im a lil confused. Perhaps if you can explain some more i might be able to help you fix it.

  5. #5
    Join Date
    Jan 2007
    Posts
    160
    After our app is installed, one must connect to the server on which it is installed to login, of course. If the server name contains an _, flakey things happen at login, I guess. I don't really know the details, but for some reason, if the name contains an _, they must use the IP address in the browser to connect.

  6. #6
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    hmm, very odd. I wouldn't think an underscore would cause a problem though as its just a standard character. And i dont think you need to escape an underscore, could be wrong though lol. But what you just did should serve your purpose.

  7. #7
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    The underscore is not a legal character for use in hostnames (defined in RFC 822).

    It is, what it is.

  8. #8
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    113
    Quote Originally Posted by NitLions View Post
    How can I get the computer name on which my AMS browser is running? Do I have to use GetLANInfo or is there another way?

    I have to determine if the computer name contains "_" (underscore) with String.Find, I guess. If so, I need to warn the user that our Web application may not work properly with an underscored system name (why, I have no idea - that's for the hardcore developers to figure out). Then I guess I'll kill the app or do whatever I am directed to do by the decistion makers at that point.

    Any help appreciated.
    The following will do it.
    cname = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ComputerName\ \ComputerName", "ComputerName", true);

    Lee

  9. #9
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by leebos View Post
    The following will do it.
    cname = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ComputerName\ \ComputerName", "ComputerName", true);
    Lee
    Something very strange. On my system there is a space displayed between the slashes in "ComputerName\\ComputerName" but looking at it as it is quoted while I am typing this, there is no space.

    Now doing a preview, I can see the space again???

    Copy and paste into AMS and it fails until I remove the space

    Is that how other people see it? There should of course not be a space there.

  10. #10
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    113
    longedge, you are correct, there should be no space. I copied it directly from one of my apps so I don't know how the spage got there. Here is another copy/paste.
    cname = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ComputerName\ \ComputerName", "ComputerName", true);

    Now I see the trouble, it's caused by this website apparently as It looks ok until I preview it.

    IR, you need to look at this.

    Lee

  11. #11
    Join Date
    Aug 2003
    Posts
    2,427
    Is there a control character or something in there? Very odd.

  12. #12
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    113
    Quote Originally Posted by longedge View Post
    Is there a control character or something in there? Very odd.
    No control characters, I retyped it to be sure.

    cname = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ComputerName\ \ComputerName", "ComputerName", true);
    Leaving out double \
    cname = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\ComputerName\Com puterName", "ComputerName", true);

    Now it moves the extra space, strange indeed.

    Here are is a few more lines from the same app. The one that gets the Workstation number is ok, the one that gets the Computer Description has the extra space after lanmanserver.
    wsnum = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\ControlSet001\\Control\\Session Manager\\Environment", "workstation", true);

    descript = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\lanmanserver \\parameters", "srvcomment", true);

    Lee

  13. #13
    Join Date
    May 2005
    Posts
    1
    10x it works well,

  14. #14
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Quote Originally Posted by leebos View Post
    No control characters, I retyped it to be sure.

    cname = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ComputerName\ \ComputerName", "ComputerName", true);
    Leaving out double \
    cname = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\ComputerName\Com puterName", "ComputerName", true);

    Now it moves the extra space, strange indeed.

    Here are is a few more lines from the same app. The one that gets the Workstation number is ok, the one that gets the Computer Description has the extra space after lanmanserver.
    wsnum = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\ControlSet001\\Control\\Session Manager\\Environment", "workstation", true);

    descript = Registry.GetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\lanmanserver \\parameters", "srvcomment", true);

    Lee
    It's vBulletin thinking someone is spamming, thinking adding spaces will make a difference.

Similar Threads

  1. run exe on target computer, but path unknown
    By Loes in forum AutoPlay Media Studio 7.5
    Replies: 9
    Last Post: 12-30-2007, 02:36 PM
  2. Is any way to log-off the computer?
    By searcher123 in forum Setup Factory 7.0
    Replies: 3
    Last Post: 06-20-2007, 10:49 PM
  3. Playback Full Computer Screen size
    By Caldane in forum AutoPlay Media Studio 4.0
    Replies: 2
    Last Post: 10-05-2004, 10:12 PM
  4. Check if a computer is reachable (ping...)
    By Martin_SBT in forum AutoPlay Media Studio 5.0
    Replies: 13
    Last Post: 01-16-2004, 12:02 PM
  5. Getting the Registered User of the Computer
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-01-2003, 02:35 PM

Posting Permissions

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