Click here to Skip to main content
15,792,063 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionOS Pin
Tuotrut22-Jan-06 19:46
Tuotrut22-Jan-06 19:46 
AnswerRe: OS Pin
waxie22-Jan-06 19:53
waxie22-Jan-06 19:53 
AnswerRe: OS Pin
Sebastian Schneider22-Jan-06 21:51
Sebastian Schneider22-Jan-06 21:51 
AnswerRe: OS Pin
Toby Opferman23-Jan-06 10:00
Toby Opferman23-Jan-06 10:00 
QuestionGet IP address of computer (MFC/VC++) Pin
waxie22-Jan-06 19:10
waxie22-Jan-06 19:10 
AnswerRe: Get IP address of computer (MFC/VC++) Pin
JonEngle22-Jan-06 20:36
JonEngle22-Jan-06 20:36 
AnswerRe: Get IP address of computer (MFC/VC++) Pin
eli1502197922-Jan-06 22:18
eli1502197922-Jan-06 22:18 
Questionhow to get all computer name in a network fastly. Pin
baldha rakesh22-Jan-06 18:53
baldha rakesh22-Jan-06 18:53 
hi everybody,
i need all computer name in a network fastly but i have make a following code which is able to get all machine name but its time taken i am giving code for you if there is possibility to change in this code to get fastly so please change this code and reply me ASAP.



BOOL CMessangerDlg::Enumration(int level, NETRESOURCE *pnr, CListCtrl *clistctrl)
{
DWORD rc;
HANDLE hEnum;
CString strTemp;
DWORD count, bufsize, ui;
NETRESOURCE buf[200];
const char *type, *cont;
//GetDlgItem(IDC_BTN_SEND)->EnableWindow( FALSE );
WORD version;
WSADATA wsaData;
int rVal;
version=MAKEWORD(1,1);
rVal=WSAStartup(version,(LPWSADATA)&wsaData);

rc = WNetOpenEnum( RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, pnr, &hEnum );

if ( rc == ERROR_ACCESS_DENIED )
{
return 1;
}
while ( 1 )
{

count = (DWORD) -1L;
bufsize = sizeof buf;
rc = WNetEnumResource( hEnum, &count, buf, &bufsize );


if ( rc != NO_ERROR )
break;
Sleep(0);

for ( ui = 0; ui < count; ++ ui )
{
//AfxMessageBox("hello2");

switch ( buf[ui].dwDisplayType )
{
case RESOURCEDISPLAYTYPE_DOMAIN:
type = "domain"; break;
case RESOURCEDISPLAYTYPE_GENERIC:
type = "generic"; break;
case RESOURCEDISPLAYTYPE_SERVER:
type = "server"; break;
case RESOURCEDISPLAYTYPE_SHARE:
type = "share"; break;
default:
type = "unknown"; break;
}

cont = ( buf[ui].dwUsage & RESOURCEUSAGE_CONTAINER )? "container": "";
if(level==2)
{
//AfxMessageBox("hello3");
CString networkmachinename;
CString str;
str=buf[ui].lpRemoteName;
str.Remove('\\');

LPHOSTENT host=gethostbyname(str);

//AfxMessageBox(str);
if(host==NULL)
{
//AfxMessageBox("one machine is off");
continue;

}
else
{
clistctrl->InsertItem(li," ");
clistctrl->SetItemText(li,0,str);
//clistctrl->SetItemText(li,1,str);
li++;
CString member;
member.Format("%d",li);
m_member.SetWindowText(member);
}

}

if ( buf[ui].dwUsage & RESOURCEUSAGE_CONTAINER)
{

Enumration( level + 1, &buf[ui] ,clistctrl);
}
}
}

WNetCloseEnum( hEnum );
Sleep(0);

WSACleanup();

return 0;

}







Bankey Khandelwal
Software Engineer

Solversa TechnologiesPvt.Ltd.
15,Yeshwant Nagar
Range Hill Road
Ganeshkhind,Pune-03
bankey.khandelwal@solversa.com
Mobile: +91-9850432990
Office : +91-20-25521888
Questionenable and disable the dialog controls Pin
Anu_Bala22-Jan-06 18:52
Anu_Bala22-Jan-06 18:52 
AnswerRe: enable and disable the dialog controls Pin
Owner drawn22-Jan-06 19:17
Owner drawn22-Jan-06 19:17 
AnswerRe: enable and disable the dialog controls Pin
David Crow23-Jan-06 5:17
David Crow23-Jan-06 5:17 
AnswerRe: enable and disable the dialog controls Pin
domehead23-Jan-06 8:03
domehead23-Jan-06 8:03 
QuestionKeyBoard Handling Pin
rajeevktripathi22-Jan-06 18:51
rajeevktripathi22-Jan-06 18:51 
AnswerRe: KeyBoard Handling Pin
Rajesh R Subramanian22-Jan-06 22:19
professionalRajesh R Subramanian22-Jan-06 22:19 
QuestionRe: KeyBoard Handling Pin
rajeevktripathi23-Jan-06 2:11
rajeevktripathi23-Jan-06 2:11 
AnswerRe: KeyBoard Handling Pin
Rage23-Jan-06 2:59
professionalRage23-Jan-06 2:59 
QuestionRe: KeyBoard Handling Pin
rajeevktripathi23-Jan-06 3:12
rajeevktripathi23-Jan-06 3:12 
AnswerRe: KeyBoard Handling Pin
Rajesh R Subramanian23-Jan-06 19:24
professionalRajesh R Subramanian23-Jan-06 19:24 
QuestionHow to use regular dll? Pin
rushing22-Jan-06 18:05
rushing22-Jan-06 18:05 
AnswerRe: How to use regular dll? Pin
Ryan Binns22-Jan-06 18:14
Ryan Binns22-Jan-06 18:14 
Questionwin98 usb Pin
act_x22-Jan-06 17:45
act_x22-Jan-06 17:45 
QuestionCleaning up the registry Pin
Shraddhan22-Jan-06 17:38
Shraddhan22-Jan-06 17:38 
QuestionMenu IDs converting to Number (VS 2003) ?!? Pin
Warren Stevens22-Jan-06 17:36
Warren Stevens22-Jan-06 17:36 
AnswerRe: Menu IDs converting to Number (VS 2003) ?!? Pin
Ryan Binns22-Jan-06 18:15
Ryan Binns22-Jan-06 18:15 
AnswerRe: Menu IDs converting to Number (VS 2003) ?!? Pin
Warren Stevens23-Jan-06 2:46
Warren Stevens23-Jan-06 2:46 

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.