Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. GetComputerNameEx

GetComputerNameEx

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Subramaniam s V
    wrote on last edited by
    #1

    Hi All, When I use GetComputerNameEx in my code, I am getting an error stating that the function does not exist. But, its given in MSDN that the function is declared in Winbase.h. I got through Winbase.h also but I dont find such a function declared. Can you please suggest if I shld include any other header file?? NOTE : I have already included Windows.h(which in turn includes Winbase.h) in my code. Awaiting your earliest response. Thanks..

    P D H D E 5 Replies Last reply
    0
    • S Subramaniam s V

      Hi All, When I use GetComputerNameEx in my code, I am getting an error stating that the function does not exist. But, its given in MSDN that the function is declared in Winbase.h. I got through Winbase.h also but I dont find such a function declared. Can you please suggest if I shld include any other header file?? NOTE : I have already included Windows.h(which in turn includes Winbase.h) in my code. Awaiting your earliest response. Thanks..

      P Offline
      P Offline
      Parthi_Appu
      wrote on last edited by
      #2

      What Win OS you are using... for GetComputerNameEx(..) minimum requirement is Win XP or Win 2000 Professional Do your Duty and Don't expect the Result

      S 1 Reply Last reply
      0
      • P Parthi_Appu

        What Win OS you are using... for GetComputerNameEx(..) minimum requirement is Win XP or Win 2000 Professional Do your Duty and Don't expect the Result

        S Offline
        S Offline
        Subramaniam s V
        wrote on last edited by
        #3

        Windows XP Professional with service pack 2. Is it specific to Visual Studio installation( I have Visual Studio 6) as I dont find the function in Winbase.h?

        1 Reply Last reply
        0
        • S Subramaniam s V

          Hi All, When I use GetComputerNameEx in my code, I am getting an error stating that the function does not exist. But, its given in MSDN that the function is declared in Winbase.h. I got through Winbase.h also but I dont find such a function declared. Can you please suggest if I shld include any other header file?? NOTE : I have already included Windows.h(which in turn includes Winbase.h) in my code. Awaiting your earliest response. Thanks..

          D Offline
          D Offline
          Dreamz
          wrote on last edited by
          #4

          Why not GetComputerName?

          S 1 Reply Last reply
          0
          • D Dreamz

            Why not GetComputerName?

            S Offline
            S Offline
            Subramaniam s V
            wrote on last edited by
            #5

            I need to get the HostName.DomainName (ComputerNameDnsFullyQualified) so I am using GetComputerNameEx. GetComputerName will give only the hostname.

            1 Reply Last reply
            0
            • S Subramaniam s V

              Hi All, When I use GetComputerNameEx in my code, I am getting an error stating that the function does not exist. But, its given in MSDN that the function is declared in Winbase.h. I got through Winbase.h also but I dont find such a function declared. Can you please suggest if I shld include any other header file?? NOTE : I have already included Windows.h(which in turn includes Winbase.h) in my code. Awaiting your earliest response. Thanks..

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              Did you see MSDN From the MSDN: "To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later"_**


              **_

              whitesky


              S 1 Reply Last reply
              0
              • S Subramaniam s V

                Hi All, When I use GetComputerNameEx in my code, I am getting an error stating that the function does not exist. But, its given in MSDN that the function is declared in Winbase.h. I got through Winbase.h also but I dont find such a function declared. Can you please suggest if I shld include any other header file?? NOTE : I have already included Windows.h(which in turn includes Winbase.h) in my code. Awaiting your earliest response. Thanks..

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                You must've missed the

                #if (_WIN32_WINNT >= 0x0500)

                directive in that same header file.


                "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                "Judge not by the eye but by the heart." - Native American Proverb

                1 Reply Last reply
                0
                • H Hamid Taebi

                  Did you see MSDN From the MSDN: "To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later"_**


                  **_

                  whitesky


                  S Offline
                  S Offline
                  Subramaniam s V
                  wrote on last edited by
                  #8

                  Hi I have tried giving #define _WIN32_WINNT 0x0501, but still it throws the same error.

                  H 1 Reply Last reply
                  0
                  • S Subramaniam s V

                    Hi I have tried giving #define _WIN32_WINNT 0x0501, but still it throws the same error.

                    H Offline
                    H Offline
                    Hamid Taebi
                    wrote on last edited by
                    #9

                    Whats application type?I used this file wihout problem_**


                    **_

                    whitesky


                    1 Reply Last reply
                    0
                    • S Subramaniam s V

                      Hi All, When I use GetComputerNameEx in my code, I am getting an error stating that the function does not exist. But, its given in MSDN that the function is declared in Winbase.h. I got through Winbase.h also but I dont find such a function declared. Can you please suggest if I shld include any other header file?? NOTE : I have already included Windows.h(which in turn includes Winbase.h) in my code. Awaiting your earliest response. Thanks..

                      E Offline
                      E Offline
                      Eric Dahlvang
                      wrote on last edited by
                      #10

                      You need a newer windbase.h - this wasn't supported in VC98. winbase.h

                      WINBASEAPI
                      BOOL
                      WINAPI
                      GetComputerNameExA (
                      IN COMPUTER_NAME_FORMAT NameType,
                      OUT LPSTR lpBuffer,
                      IN OUT LPDWORD nSize
                      );
                      WINBASEAPI
                      BOOL
                      WINAPI
                      GetComputerNameExW (
                      IN COMPUTER_NAME_FORMAT NameType,
                      OUT LPWSTR lpBuffer,
                      IN OUT LPDWORD nSize
                      );
                      #ifdef UNICODE
                      #define GetComputerNameEx GetComputerNameExW
                      #else
                      #define GetComputerNameEx GetComputerNameExA
                      #endif // !UNICODE

                      --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups