Click here to Skip to main content
15,923,789 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how can i select a particular object using the list pointers to objects? Pin
Christian Graus29-May-01 19:16
protectorChristian Graus29-May-01 19:16 
GeneralRe: how can i select a particular object using the list pointers to objects? Pin
pathi30-May-01 3:18
pathi30-May-01 3:18 
GeneralRe: how can i select a particular object using the list pointers to objects? Pin
Christian Graus30-May-01 11:28
protectorChristian Graus30-May-01 11:28 
GeneralAdd Column in DataGRid Control???URGENT!!!! Pin
29-May-01 18:35
suss29-May-01 18:35 
QuestionSDI OnOpenFile????? Pin
29-May-01 18:21
suss29-May-01 18:21 
AnswerRe: SDI OnOpenFile????? Pin
Christian Graus29-May-01 19:17
protectorChristian Graus29-May-01 19:17 
QuestionHow to find hostnames and IP in network? Pin
29-May-01 17:02
suss29-May-01 17:02 
AnswerRe: How to find hostnames and IP in network? Pin
Ghazi H. Wadi30-May-01 12:09
Ghazi H. Wadi30-May-01 12:09 
In the command line type

IPCONFIG /ALL

or

#include <windows.h>
#include <winsock.h>
#include <wsnetbs.h>
#include <wsipx.h>
#include <stdio.h>

#pragma comment(lib, "ws2_32.lib")

main()
{
    struct hostent FAR *pHostAddr;
    struct in_addr in;
    char   pszHostName [ 255 ];

    int      err;
    WORD     wVersionRequired;
    WSADATA  wsaData;
    wVersionRequired = MAKEWORD(1,1);
    err = WSAStartup(wVersionRequired, &wsaData);
    if (err != 0)
        exit(1);

    if (gethostname (pszHostName, sizeof(pszHostName)) != SOCKET_ERROR)
    {
        printf("Local Host Name: %s\n", pszHostName);
    }
    else
    {
        printf("gethostname error: %ld\n", WSAGetLastError());
        exit(-1);
    }

    // get local host address

    pHostAddr = gethostbyname ( pszHostName );
    if (pHostAddr == NULL)
    {
        printf("gethostbyname error: for %s\n",pszHostName);
        exit(-1);
    }
    else // print out details
    {
        printf("Host Name: %s\n",       pHostAddr->h_name);
        printf("Address Type: %x\n",    pHostAddr->h_addrtype);
        printf("Address Length: %d\n",  pHostAddr->h_length);
        printf("Host Address: %lx \n",  pHostAddr->h_addr);
        in.s_addr = *((u_long *)pHostAddr->h_addr);
        printf("Dotted Address: %s\n", inet_ntoa(in));
    }
}



Cheers
Alfadhly


/*
It is Illogical to define an inventor by his invention
*/
GeneralMSControl on ATL dialog Pin
29-May-01 16:13
suss29-May-01 16:13 
GeneralRe: MSControl on ATL dialog Pin
Matt Philmon29-May-01 17:22
Matt Philmon29-May-01 17:22 
GeneralRe: MSControl on ATL dialog Pin
29-May-01 18:01
suss29-May-01 18:01 
GeneralRe: MSControl on ATL dialog Pin
Matt Philmon30-May-01 6:42
Matt Philmon30-May-01 6:42 
GeneralRe: MSControl on ATL dialog Pin
30-May-01 10:43
suss30-May-01 10:43 
GeneralRe: MSControl on ATL dialog Pin
Matt Philmon30-May-01 17:24
Matt Philmon30-May-01 17:24 
GeneralRe: MSControl on ATL dialog Pin
Matt Philmon30-May-01 17:41
Matt Philmon30-May-01 17:41 
GeneralRe: MSControl on ATL dialog Pin
30-May-01 19:04
suss30-May-01 19:04 
GeneralRe: MSControl on ATL dialog Pin
Matt Philmon31-May-01 4:07
Matt Philmon31-May-01 4:07 
GeneralRe: MSControl on ATL dialog Pin
31-May-01 4:20
suss31-May-01 4:20 
GeneralRe: MSControl on ATL dialog Pin
Matt Philmon31-May-01 10:23
Matt Philmon31-May-01 10:23 
GeneralUnicode Clipboard Pin
29-May-01 13:41
suss29-May-01 13:41 
GeneralRe: Unicode Clipboard Pin
Tim Deveaux30-May-01 7:36
Tim Deveaux30-May-01 7:36 
GeneralRe: Unicode Clipboard Pin
30-May-01 13:22
suss30-May-01 13:22 
GeneralImporting existing Dialog interfaces into a new SDI application. Pin
Kimball M. Rudeen29-May-01 13:05
Kimball M. Rudeen29-May-01 13:05 
GeneralRe: Importing existing Dialog interfaces into a new SDI application. Pin
Christian Graus29-May-01 13:12
protectorChristian Graus29-May-01 13:12 
GeneralTimer in a Dialog Box Pin
RobJones29-May-01 12:54
RobJones29-May-01 12:54 

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

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