Получение списка компьютеров в домене.
void CMQMsgDlg::LoadNetwork()
{
SERVER_INFO_100* lpBuf;
SERVER_INFO_100* lpComp;
DWORD dwEntriesRead;
DWORD dwTotalEntries;
DWORD i;
LPTSTR szCompName;
if( NetServerEnum( NULL,100,(LPBYTE*) &lpBuf,MAX_PREFERRED_LENGTH,&dwEntriesRead,
&dwTotalEntries,SV_TYPE_ALL,NULL,0 ) == NERR_Success )
{
lpComp = lpBuf;
for( i = 0; i < dwEntriesRead; i++ )
{
if( UnicodeToAnsi( (LPWSTR)lpComp
->sv100_name,&szCompName ) )
{
.....................
delete szCompName;
}
lpComp++;
}
NetApiBufferFree( lpBuf );
}
}