CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Obtain Hostname

  1. #1
    Join Date
    Oct 2003
    Posts
    72

    Obtain Hostname

    Hi guys

    Is there a function that retrieves the hostname as a string of the computer in which an application is running?

    Thanks in advance

  2. #2
    Join Date
    Jul 2005
    Location
    E: 120°.6, N: 31°.3′
    Posts
    795

    Re: Obtain Hostname

    Little by little one goes far
    Keep moving.......!
    Nothing is impossible !

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Obtain Hostname

    Have a look at gethostbyname in MSDN

  4. #4
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Obtain Hostname

    Quote Originally Posted by elektroman
    Hi guys

    Is there a function that retrieves the hostname as a string of the computer in which an application is running?

    Thanks in advance
    Do you mean Computer Name Or Computer's Full DNS name ?

    You can use GetComputerName Or GetComputerNameEx.
    Regards,
    Ramkrishna Pawar

  5. #5
    Join Date
    Oct 2003
    Posts
    72

    Re: Obtain Hostname

    I mean the name that I obtain when from prompt I type hostname

  6. #6
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Obtain Hostname

    Quote Originally Posted by elektroman
    I mean the name that I obtain when from prompt I type hostname
    Thats your local computer name, can be obtained by calling GetComputerName.
    Regards,
    Ramkrishna Pawar

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

Featured