Click here to Skip to main content
15,907,687 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionOpen a external application due tu the document type Pin
Alfred Willi14-Mar-06 4:42
Alfred Willi14-Mar-06 4:42 
AnswerRe: Open a external application due tu the document type Pin
includeh1014-Mar-06 4:50
includeh1014-Mar-06 4:50 
AnswerRe: Open a external application due tu the document type Pin
David Crow14-Mar-06 5:40
David Crow14-Mar-06 5:40 
GeneralRe: Open a external application due tu the document type Pin
Alfred Willi16-Mar-06 4:56
Alfred Willi16-Mar-06 4:56 
QuestionBlue Screen Pin
Aqueel14-Mar-06 4:10
Aqueel14-Mar-06 4:10 
Questionview computers in my lan Pin
jspike14-Mar-06 4:04
jspike14-Mar-06 4:04 
AnswerRe: view computers in my lan Pin
David Crow14-Mar-06 4:23
David Crow14-Mar-06 4:23 
GeneralRe: view computers in my lan Pin
jspike14-Mar-06 4:40
jspike14-Mar-06 4:40 
I have this code, but it seems Visual Studio .Net has trouble with WNetOpenEnum, WNetEnumRecources and WNetCloseEnum.

	CString strTemp;<br />
	CListBox *pList = (CListBox*) GetDlgItem(IDC_LIST1);<br />
	pList->ResetContent();<br />
<br />
	struct hostent *host;	<br />
	struct in_addr *ptr;	// To retrieve the IP Address<br />
<br />
 	DWORD dwScope = RESOURCE_CONTEXT;<br />
	NETRESOURCE *NetResource = NULL;	<br />
	HANDLE hEnum;	<br />
	WNetOpenEnum( dwScope, NULL, NULL, NULL, &hEnum );	<br />
	<br />
	WSADATA wsaData;  <br />
	WSAStartup(MAKEWORD(1,1),&wsaData);<br />
<br />
	if ( hEnum )	<br />
	{<br />
		DWORD Count = 0xFFFFFFFF;<br />
		DWORD BufferSize = 2048;<br />
		LPVOID Buffer = new char[2048];<br />
		WNetEnumResource( hEnum, &Count, Buffer, &BufferSize );<br />
<br />
		NetResource = (NETRESOURCE*)Buffer;<br />
<br />
		char szHostName[200];<br />
<br />
		for ( unsigned int i = 0; i < BufferSize/sizeof(NETRESOURCE); i++, NetResource++ )<br />
		{	<br />
			if ( NetResource->dwUsage == RESOURCEUSAGE_CONTAINER && NetResource->dwType == RESOURCETYPE_ANY )<br />
			{<br />
				if ( NetResource->lpRemoteName )<br />
				{<br />
					CString strFullName = NetResource->lpRemoteName;<br />
					<br />
					if ( 0 == strFullName.Left(2).Compare("\\\\") )<br />
						strFullName = strFullName.Right(strFullName.GetLength()-2);<br />
<br />
					gethostname( szHostName, strlen( szHostName ) );<br />
					host = gethostbyname(strFullName);<br />
					ptr = (struct in_addr *) host->h_addr_list[0];<br />
<br />
					int a = ptr->S_un.S_un_b.s_b1;  // Eg. 211.40.35.76 split up like this.<br />
					int b = ptr->S_un.S_un_b.s_b2;  //     40<br />
					int c = ptr->S_un.S_un_b.s_b3;  //     35<br />
					int d = ptr->S_un.S_un_b.s_b4;  //     76<br />
<br />
					strTemp.Format("%s -->  %d.%d.%d.%d",strFullName,a,b,c,d);<br />
					pList->AddString(strTemp);<br />
				}<br />
			}<br />
		}<br />
		delete Buffer;<br />
		WNetCloseEnum( hEnum );<br />
	}<br />
	WSACleanup();	

GeneralRe: view computers in my lan Pin
David Crow14-Mar-06 5:35
David Crow14-Mar-06 5:35 
GeneralRe: view computers in my lan Pin
jspike14-Mar-06 8:18
jspike14-Mar-06 8:18 
GeneralRe: view computers in my lan Pin
ThatsAlok14-Mar-06 18:28
ThatsAlok14-Mar-06 18:28 
GeneralRe: view computers in my lan Pin
jspike14-Mar-06 20:18
jspike14-Mar-06 20:18 
Questionwchat_t to normal char Pin
RichardS14-Mar-06 4:00
RichardS14-Mar-06 4:00 
GeneralRe: wchat_t to normal char Pin
Michael Dunn14-Mar-06 8:39
sitebuilderMichael Dunn14-Mar-06 8:39 
AnswerRe: wchat_t to normal char Pin
David Crow14-Mar-06 4:26
David Crow14-Mar-06 4:26 
AnswerRe: wchat_t to normal char Pin
Nemanja Trifunovic14-Mar-06 6:52
Nemanja Trifunovic14-Mar-06 6:52 
AnswerRe: wchat_t to normal char Pin
ThatsAlok14-Mar-06 18:29
ThatsAlok14-Mar-06 18:29 
Questionhow to Acesss Remote Database through Internet Pin
J512198214-Mar-06 3:38
J512198214-Mar-06 3:38 
QuestionSetting color of text with printf() Pin
jerry1211a14-Mar-06 3:22
jerry1211a14-Mar-06 3:22 
AnswerRe: Setting color of text with printf() Pin
David Crow14-Mar-06 4:28
David Crow14-Mar-06 4:28 
GeneralRe: Setting color of text with printf() Pin
jerry1211a14-Mar-06 5:31
jerry1211a14-Mar-06 5:31 
QuestionExpress Edition 2005 and VC++6 Pin
thierrypp14-Mar-06 2:56
thierrypp14-Mar-06 2:56 
AnswerRe: Express Edition 2005 and VC++6 Pin
Cedric Moonen14-Mar-06 3:01
Cedric Moonen14-Mar-06 3:01 
GeneralRe: Express Edition 2005 and VC++6 Pin
thierrypp14-Mar-06 3:10
thierrypp14-Mar-06 3:10 
GeneralRe: Express Edition 2005 and VC++6 Pin
Cedric Moonen14-Mar-06 3:16
Cedric Moonen14-Mar-06 3:16 

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.