CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Location
    Madrid - Spain
    Posts
    78

    Computer name in the registry?

    where can i find my Computer's name in the registry?

    Or, what is the API function to get the name?


    Thanks!

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Lightbulb

    Code:
       
       DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
       LPTSTR pszName = new TCHAR[dwSize];
       BOOL bRet = ::GetComputerName( pszName, &dwSize );
       delete []pszName;
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244
    Also see
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
    in the registry
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

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