Click here to Skip to main content
11,483,983 members (68,498 online)
Click here to Skip to main content

IPEnum v1.01 - IP Address Enumeration

, 3 Mar 2000 99.4K 1.4K 20
Rate this:
Please Sign up or sign in to vote.
An MFC class to allow enumeration of IP addresses.
  • Download source files - 11 Kb
  • Welcome to IPENUM, a freeware MFC class and console application to allow enumeration of the IP addresses a machine possesses.


    History
    Usage
    Contacting the Author


    History

    V1.0 (21th April 1998)
    • Initial public release.

    V1.01 (4th January 1999)

    • Minor update to the documentation.
    • Provision of a VC 5 workspace file now as standard.
    • UNICODE enabled all the code.
    • IPENUM now uses MFC DLL and C Runtime DLL's instead of statically linking. This means that the IPENUM executable requires these files to be installed. If you haven't already got the MFC 4.2b DLLs on your machine (MFC42.DLL in your Windows system directory), then grab them from Microsoft's web site at http://activex.microsoft.com/controls/vc/mfc42.cab.


    Usage

    To run the IPEnu console application, open a command prompt and simple type IPEnum. It will then display all the IP addresses which the


    To use the MFC class CIPEnum in your own code, simply include the ipenum.cpp module in your project and #include ipenum.h file in whichever of your modules require it. You will then need to derive your own class from CIPEnum and override the pure virtual function EnumCallbackFunction(). Further information about this function is included below. To see this in action, have a look at the CMyIPEnum in the module main.cpp.


    CIPEnum::EnumCallbackFunction

    virtual BOOL CIPEnum::EnumCallbackFunction(int nAdapter, const in_addr& address)=0;

    Return Value:
    TRUE if the the enumeration of the IP addresses should continue, FALSE to stop enumeration.

    Parameters:

    • nAdapter -- The index of the IP address being returned. This value will be incremented each time your callback function is called.  The value will start from 0.
    • address -- The IP address for the current adapter. For further information about this structure have a look at the Win32 SDK documentation.



    Contacting the Author

    PJ Naughter
    Email: pjn@indigo.ie
    Web: http://www.naughter.com
    4th January 1999


    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    Share

    About the Author

    PJ Naughter

    United States United States
    No Biography provided

    Comments and Discussions

     
    QuestionHow can I set static IP address using c++ code and win32 API.Can anyone pls help Pin
    an894-Jul-08 2:10
    memberan894-Jul-08 2:10 
    GeneralVery good article but... Pin
    dSolariuM29-Mar-05 5:52
    memberdSolariuM29-Mar-05 5:52 
    GeneralRe: Very good article but... Pin
    pjnaughter29-Mar-05 10:37
    memberpjnaughter29-Mar-05 10:37 
    Generalim stuck with this program please help Pin
    VashReilly17-Jul-03 13:20
    sussVashReilly17-Jul-03 13:20 
    Generalgethostbyaddr() Pin
    Swinefeaster25-Apr-03 8:55
    memberSwinefeaster25-Apr-03 8:55 
    Questionhow do I scan opened port on remote host?? Pin
    CNH11-Jun-02 22:25
    memberCNH11-Jun-02 22:25 
    GeneralGetting my machine own IP with C++ under linux/*ix Pin
    nayco24-Oct-01 4:34
    membernayco24-Oct-01 4:34 
    Generalget ip address Pin
    chandra8-Jan-01 13:07
    memberchandra8-Jan-01 13:07 
    GeneralRe: get ip address Pin
    benzyl rechner13-Mar-01 12:50
    memberbenzyl rechner13-Mar-01 12:50 
    // For Win32. link with wsock32.lib :
    WSAData wsa1;
    if (WSAStartup(MAKEWORD(1, 1), &wsa1) != 0)
    return -1;



    char shostname[255];
    int e;

    e=gethostname(shostname, sizeof(shostname));

    if (e != 0) {
    e= WSAGetLastError ();
    return -1;
    }

    struct hostent *phost = gethostbyname(shostname);
    if (phost == 0)
    return -1;

    for (int i = 0; phost->h_addr_list[i] != 0; ++i) {
    struct in_addr addr;
    memcpy(&addr, phost->h_addr_list[i], sizeof(struct in_addr));
    //ip address is inet_ntoa(addr)
    char oip[50];
    strcpy(oip,inet_ntoa(addr));
    //m_server.AppendText(oip);
    }


    Regards, BR
    GeneralRe: get ip address Pin
    hhelper16-Mar-03 15:39
    memberhhelper16-Mar-03 15:39 
    GeneralRe: get ip address Pin
    FXMC19-Apr-06 6:13
    memberFXMC19-Apr-06 6:13 
    Generalget ip address Pin
    chandra8-Jan-01 13:07
    memberchandra8-Jan-01 13:07 
    QuestionHow do I enum all IPs over a domain? Pin
    zeuss19-Dec-00 19:26
    memberzeuss19-Dec-00 19:26 
    Generalapplication handle and IP port bound Pin
    appler25-Oct-00 23:15
    sussappler25-Oct-00 23:15 
    QuestionHow can i get IP addresses of all pcs of Network ... Pin
    manish9-Sep-00 6:07
    sussmanish9-Sep-00 6:07 
    QuestionHow do I get the protocol 's name? Pin
    Orry20-Jul-00 5:33
    sussOrry20-Jul-00 5:33 
    GeneralNetmask/Broadcast IP for these IPs Pin
    Ryan Schneider19-May-00 7:03
    sussRyan Schneider19-May-00 7:03 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Terms of Use | Mobile
    Web03 | 2.8.150520.1 | Last Updated 4 Mar 2000
    Article Copyright 2000 by PJ Naughter
    Everything else Copyright © CodeProject, 1999-2015
    Layout: fixed | fluid