Click here to Skip to main content
16,017,333 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralReference Counting problem Pin
Anonymous7-Aug-02 20:40
Anonymous7-Aug-02 20:40 
GeneralRe: Reference Counting problem Pin
Paul M Watt7-Aug-02 21:00
mentorPaul M Watt7-Aug-02 21:00 
GeneralRe: Reference Counting problem Pin
Anonymous8-Aug-02 0:40
Anonymous8-Aug-02 0:40 
GeneralRe: Reference Counting problem Pin
Paul M Watt9-Aug-02 8:55
mentorPaul M Watt9-Aug-02 8:55 
GeneralDll Registration Pin
abhinarulkar7-Aug-02 20:09
abhinarulkar7-Aug-02 20:09 
GeneralRe: Dll Registration Pin
Paul M Watt7-Aug-02 21:04
mentorPaul M Watt7-Aug-02 21:04 
Questionhow can i get current PC's ip? Pin
zecodela7-Aug-02 19:56
zecodela7-Aug-02 19:56 
AnswerRe: how can i get current PC's ip? Pin
Dudi Avramov7-Aug-02 21:07
Dudi Avramov7-Aug-02 21:07 
C++
#include <winsock2.h> 

DWORD InitWinSock()
{
     WSADATA data;  
     if (WSAStartup(MAKEWORD(2, 2), &data) != 0)
		return WSAGetLastError();  
	 return 0;
}

DWORD GetIpAddress(LPCTSTR lpszHost, LPSTR ip)
{
	LPHOSTENT lphost;
	lphost = gethostbyname(lpszHost);
	if (lphost == NULL)
	{
		*ip = NULL;
		return WSAGetLastError();
	}
	SOCKADDR_IN sockAddr;
	sockAddr.sin_addr.s_addr = ((LPIN_ADDR)lphost->h_addr)->s_addr;
	strcpy(ip,inet_ntoa(sockAddr.sin_addr));
	return 0;
}

void main()
{
    InitWinSock();

    char szHost[256];
    gethostname(szHost,sizeof(szHost));
    char ip[16];
    GetIpAddress(szHost,ip);
}


don't forget to link with Ws2_32.lib.
Generaladding named item to script engine Pin
Anonymous7-Aug-02 19:38
Anonymous7-Aug-02 19:38 
GeneralRe: adding named item to script engine Pin
Stuart Dootson7-Aug-02 19:56
professionalStuart Dootson7-Aug-02 19:56 
GeneralADO connection String Pin
unknown soldier7-Aug-02 19:33
unknown soldier7-Aug-02 19:33 
GeneralRe: ADO connection String Pin
Michael P Butler7-Aug-02 22:01
Michael P Butler7-Aug-02 22:01 
GeneralWindows Fonts problem Pin
Shamoon7-Aug-02 18:34
Shamoon7-Aug-02 18:34 
GeneralBitMapInfoHeader question. Pin
nss7-Aug-02 18:34
nss7-Aug-02 18:34 
GeneralRe: BitMapInfoHeader question. Pin
Chris Losinger7-Aug-02 18:39
professionalChris Losinger7-Aug-02 18:39 
Generaldynamic popup menu Pin
bryce7-Aug-02 18:32
bryce7-Aug-02 18:32 
GeneralRe: dynamic popup menu Pin
Chris Losinger7-Aug-02 18:45
professionalChris Losinger7-Aug-02 18:45 
GeneralRe: dynamic popup menu Pin
bryce7-Aug-02 18:49
bryce7-Aug-02 18:49 
GeneralRe: dynamic popup menu Pin
Chris Losinger7-Aug-02 18:56
professionalChris Losinger7-Aug-02 18:56 
GeneralRe: dynamic popup menu Pin
bryce7-Aug-02 19:00
bryce7-Aug-02 19:00 
GeneralRe: dynamic popup menu Pin
Chris Losinger7-Aug-02 19:03
professionalChris Losinger7-Aug-02 19:03 
GeneralRe: dynamic popup menu Pin
bryce7-Aug-02 21:29
bryce7-Aug-02 21:29 
GeneralRe: dynamic popup menu Pin
Chris Losinger7-Aug-02 21:31
professionalChris Losinger7-Aug-02 21:31 
GeneralRe: dynamic popup menu Pin
bryce7-Aug-02 21:33
bryce7-Aug-02 21:33 
GeneralRe: dynamic popup menu Pin
Chris Losinger7-Aug-02 21:35
professionalChris Losinger7-Aug-02 21:35 

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.