Click here to Skip to main content
15,902,276 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to male some window - be over some other windows ? Pin
l a u r e n28-Jan-04 8:24
l a u r e n28-Jan-04 8:24 
GeneralEN_SELCHANGE Notification handling Pin
Muhammad Ahmed28-Jan-04 2:04
Muhammad Ahmed28-Jan-04 2:04 
GeneralRe: EN_SELCHANGE Notification handling Pin
David Crow28-Jan-04 2:42
David Crow28-Jan-04 2:42 
GeneralRe: EN_SELCHANGE Notification handling Pin
Muhammad Ahmed28-Jan-04 3:02
Muhammad Ahmed28-Jan-04 3:02 
GeneralWin32 - ActiveX question Pin
Scozturk28-Jan-04 2:00
professionalScozturk28-Jan-04 2:00 
GeneralRe: Win32 - ActiveX question Pin
Mike Dimmick28-Jan-04 2:30
Mike Dimmick28-Jan-04 2:30 
GeneralIP Address Pin
AnsGe28-Jan-04 1:36
AnsGe28-Jan-04 1:36 
GeneralRe: IP Address Pin
SJolly28-Jan-04 1:51
SJolly28-Jan-04 1:51 
Hello,

I've done this before using windows sockets.
I don't know if it's the best way, but it definitely works:

char szHostName[400];
struct hostent *hostinfo = NULL;
IN_ADDR addr;
char szIP[16]; // "xxx.xxx.xxx.xxx\0"
ULONG ulIP = 0;

// get the dns name as a string
gethostname(szHostName, 400);

// get the host info (contains ip address)
hostinfo = gethostbyname(szHostName);

if(hostinfo == NULL)
{
DWORD dwError = WSAGetLastError();
// handle the error
}
else
{
// get the ip as ULONG
ulIP = *reinterpret_cast<pulong>(hostinfo->h_addr_list[0]);

// put the ip it into an IN_ADDR
addr.S_un.S_addr = ulIP;

// changes ip into string
sprintf(szIP, "%s", inet_ntoa(addr));

TRACE("My IP address is %s\n", szIP);
}

Regards,
Simon
GeneralRe: IP Address Pin
Anonymous29-Jan-04 0:24
Anonymous29-Jan-04 0:24 
GeneralRe: IP Address Pin
SJolly29-Jan-04 0:40
SJolly29-Jan-04 0:40 
GeneralCPU Usage Pin
YanivNahum28-Jan-04 1:29
YanivNahum28-Jan-04 1:29 
GeneralRe: CPU Usage Pin
David Crow28-Jan-04 2:47
David Crow28-Jan-04 2:47 
QuestionHow we can convert string to number or number to string? Pin
Mehdi_Hosseinpour28-Jan-04 1:03
Mehdi_Hosseinpour28-Jan-04 1:03 
AnswerRe: How we can convert string to number or number to string? Pin
YanivNahum28-Jan-04 1:27
YanivNahum28-Jan-04 1:27 
AnswerRe: How we can convert string to number or number to string? Pin
Anonymous28-Jan-04 1:52
Anonymous28-Jan-04 1:52 
AnswerRe: How we can convert string to number or number to string? Pin
toxcct28-Jan-04 2:18
toxcct28-Jan-04 2:18 
QuestionHow can open files inside program? Pin
Mehdi_Hosseinpour28-Jan-04 0:57
Mehdi_Hosseinpour28-Jan-04 0:57 
AnswerRe: How can open files inside program? Pin
Cedric Moonen28-Jan-04 1:41
Cedric Moonen28-Jan-04 1:41 
GeneralRe: How can open files inside program? Pin
David Crow28-Jan-04 2:50
David Crow28-Jan-04 2:50 
GeneralRe: How can open files inside program? Pin
Cedric Moonen28-Jan-04 3:02
Cedric Moonen28-Jan-04 3:02 
GeneralRadio Button problem Pin
Shenthil28-Jan-04 0:55
Shenthil28-Jan-04 0:55 
GeneralRe: Radio Button problem Pin
AnsGe28-Jan-04 1:41
AnsGe28-Jan-04 1:41 
GeneralRe: Radio Button problem Pin
Antti Keskinen28-Jan-04 1:51
Antti Keskinen28-Jan-04 1:51 
GeneralRe: Radio Button problem Pin
Shenthil28-Jan-04 3:41
Shenthil28-Jan-04 3:41 
GeneralTCHAR Strings and concatonation issues Pin
TomD227-Jan-04 23:53
TomD227-Jan-04 23:53 

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.