Click here to Skip to main content
16,006,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: caling an exe from dialog box Pin
Rickard Andersson207-Apr-02 10:54
Rickard Andersson207-Apr-02 10:54 
GeneralRe: caling an exe from dialog box Pin
7-Apr-02 11:12
suss7-Apr-02 11:12 
GeneralRe: caling an exe from dialog box Pin
Rickard Andersson207-Apr-02 11:32
Rickard Andersson207-Apr-02 11:32 
GeneralIgnoring 20 characters Pin
7-Apr-02 9:27
suss7-Apr-02 9:27 
GeneralRe: Ignoring 20 characters Pin
ColinDavies7-Apr-02 10:05
ColinDavies7-Apr-02 10:05 
GeneralRe: Ignoring 20 characters Pin
Todd Smith7-Apr-02 10:33
Todd Smith7-Apr-02 10:33 
GeneralRe: Ignoring 20 characters Pin
Phil Speller7-Apr-02 12:15
Phil Speller7-Apr-02 12:15 
GeneralResolving Hostname :: MFC Pin
valikac7-Apr-02 9:11
valikac7-Apr-02 9:11 
Hi.

I am working on a simple program that resolves hostname. Here is the concept:

Enter hostname: www.google.com
Resolve IP: 216.239.33.101

The program has a dialog box for the user to enter the hostname such as (www.google.com or www.yahoo.com).
Here is the function that does it:

-----
void CDomainDNS::resolveHost(const CString &rHName)
{
WSAData wData;

if (WSAStartup(MAKEWORD(2,2), &wData) == SOCKET_ERROR)
{
CString error;
error.Format("Error initialization Winsock");
AfxMessageBox(error);

return;
}

hostent *host = 0;

host = gethostbyname(rHName);

if (host == 0)
mVeri = false;

else
{
mIP = inet_ntoa(*(reinterpret_cast(host->h_addr)));

mVeri = true;
}
}
-----

The code above works perfect under Win32 *console*. However, it only outputs my *internal* ip in MFC application mode.

For example:

Enter hostname: www.google.com
Resolve IP: 192.168.0.1

Is there something I need to change or add when dealing with the code above in Win32 MFC environment? Maybe there is a better tool for resolve hostname via MFC?

Thanks,
Kuphryn
GeneralRe: Resolving Hostname :: MFC Pin
Phil Speller7-Apr-02 22:48
Phil Speller7-Apr-02 22:48 
GeneralRe: Resolving Hostname :: MFC Pin
valikac8-Apr-02 4:36
valikac8-Apr-02 4:36 
GeneralWhere to start (new question) Pin
SilverShalkin7-Apr-02 7:40
SilverShalkin7-Apr-02 7:40 
GeneralRe: Where to start (new question) Pin
Paul M Watt7-Apr-02 8:29
mentorPaul M Watt7-Apr-02 8:29 
GeneralRe: Where to start (new question) Pin
SilverShalkin7-Apr-02 8:26
SilverShalkin7-Apr-02 8:26 
GeneralRe: Where to start (new question) Pin
Paul M Watt7-Apr-02 8:59
mentorPaul M Watt7-Apr-02 8:59 
GeneralRe: Where to start (new question) Pin
Christian Graus7-Apr-02 10:09
protectorChristian Graus7-Apr-02 10:09 
GeneralRe: Where to start (new question) Pin
SilverShalkin7-Apr-02 15:25
SilverShalkin7-Apr-02 15:25 
GeneralRe: Where to start (new question) Pin
Christian Graus7-Apr-02 15:26
protectorChristian Graus7-Apr-02 15:26 
GeneralRe: Where to start (new question) Pin
SilverShalkin7-Apr-02 15:49
SilverShalkin7-Apr-02 15:49 
Generalnice book for C++ Pin
7-Apr-02 7:38
suss7-Apr-02 7:38 
GeneralRe: nice book for C++ Pin
alex.barylski7-Apr-02 18:08
alex.barylski7-Apr-02 18:08 
GeneralGrrrrr (quick newbie query) Pin
7-Apr-02 7:35
suss7-Apr-02 7:35 
GeneralRe: Grrrrr (quick newbie query) Pin
PJ Arends7-Apr-02 8:05
professionalPJ Arends7-Apr-02 8:05 
GeneralDisable Resize Window :: MFC Pin
valikac7-Apr-02 7:01
valikac7-Apr-02 7:01 
GeneralRe: Disable Resize Window :: MFC Pin
Paul M Watt7-Apr-02 7:05
mentorPaul M Watt7-Apr-02 7:05 
GeneralRe: Disable Resize Window :: MFC Pin
valikac7-Apr-02 7:10
valikac7-Apr-02 7:10 

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.