powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / C++ [игнор отключен] [закрыт для гостей] / Поиск компов в сети ...
6 сообщений из 6, страница 1 из 1
Поиск компов в сети ...
    #33456133
s666
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Извините что уже задавал этот вопрос, но всё же ответ, хотелось бы на него услышать ...
Каким способом можно найти компьютеры в сети, а точнее их имена сервера ?
И вывести их имена в список например ?
Прошу вас господа ответить как можно подробнее PLEASE.
...
Рейтинг: 0 / 0
Поиск компов в сети ...
    #33456298
Фотография JibSkeart
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
А точнее , вам компутеры , или тока сервера ?
...
Рейтинг: 0 / 0
Поиск компов в сети ...
    #33456512
s666
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
JibSkeart
---------
Найти нужно
все машины подключенные к сети, например: 31_3 или MISHA.
Прошу вас, пожалуйста ?
...
Рейтинг: 0 / 0
Поиск компов в сети ...
    #33458443
s666
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Это я нашёл здесь на форуме:

Lelikk
BOOL WINAPI EnumerateFunc(HWND hwnd,
HDC hdc,
LPNETRESOURCE lpnr)
{
DWORD dwResult, dwResultEnum;
HANDLE hEnum;
DWORD cbBuffer = 16384; // 16K is a good size
DWORD cEntries = -1; // enumerate all possible entries
LPNETRESOURCE lpnrLocal; // pointer to enumerated structures
DWORD i;
//
// Call the WNetOpenEnum function to begin the enumeration.
//
dwResult = WNetOpenEnum(RESOURCE_GLOBALNET, // all network resources
RESOURCETYPE_ANY, // all resources
0, // enumerate all resources
lpnr, // NULL first time the function is called
&hEnum); // handle to the resource

if (dwResult != NO_ERROR)
{
//
// Process errors with an application-defined error handler.
//
NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetOpenEnum");
return FALSE;
}
//
// Call the GlobalAlloc function to allocate resources.
//
lpnrLocal = (LPNETRESOURCE) GlobalAlloc(GPTR, cbBuffer);
if (lpnrLocal == NULL)
return FALSE;

do
{
//
// Initialize the buffer.
//
ZeroMemory(lpnrLocal, cbBuffer);
//
// Call the WNetEnumResource function to continue
// the enumeration.
//
dwResultEnum = WNetEnumResource(hEnum, // resource handle
&cEntries, // defined locally as -1
lpnrLocal, // LPNETRESOURCE
&cbBuffer); // buffer size
//
// If the call succeeds, loop through the structures.
//
if (dwResultEnum == NO_ERROR)
{
for(i = 0; i < cEntries; i++)
{
// Call an application-defined function to
// display the contents of the NETRESOURCE structures.
//
DisplayStruct(hdc, &lpnrLocal );

// If the NETRESOURCE structure represents a container resource,
// call the EnumerateFunc function recursively.

if(RESOURCEUSAGE_CONTAINER == (lpnrLocal.dwUsage
& RESOURCEUSAGE_CONTAINER))
if(!EnumerateFunc(hwnd, hdc, &lpnrLocal))
TextOut(hdc, 10, 10, "EnumerateFunc returned FALSE.", 29);
}
}
// Process errors.
//
else if (dwResultEnum != ERROR_NO_MORE_ITEMS)
{
NetErrorHandler(hwnd, dwResultEnum, (LPSTR)"WNetEnumResource");
break;
}
}
//
// End do.
//
while(dwResultEnum != ERROR_NO_MORE_ITEMS);
//
// Call the GlobalFree function to free the memory.
//
GlobalFree((HGLOBAL)lpnrLocal);
//
// Call WNetCloseEnum to end the enumeration.
//
dwResult = WNetCloseEnum(hEnum);

if(dwResult != NO_ERROR)
{
//
// Process errors.
//
NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetCloseEnum");
return FALSE;
}

return TRUE;
}


Но к сожалению так и не разобрался.
Какой header нужен для NetErrorHandler ?
Help people ?
...
Рейтинг: 0 / 0
Поиск компов в сети ...
    #33458522
Фотография Cerebrum
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
Retrieving Network Errors
Windows NT Only

When one of the WNet functions returns WN_EXTENDED_ERROR, an application can call the WNetGetLastError function to get more information about the error that occurred. This information is usually specific to the network provider. 

The following example illustrates an application-defined error-handling function (NetErrorHandler) that takes three arguments: a window handle, the error code returned by one of the WNet functions, and the name of the function that produced the error. If the error code is WN_EXTENDED_ERROR, NetErrorHandler calls WNetGetLastError to get extended error information. 

BOOL WINAPI NetErrorHandler(HWND hwnd, 
                            DWORD dwErrorCode, 
                            LPSTR lpszFunction) 
{ 
    DWORD dwWNetResult, dwLastError; 
    CHAR szError[ 256 ]; 
    CHAR szCaption[ 256 ]; 
    CHAR szDescription[ 256 ]; 
    CHAR szProvider[ 256 ]; 
 
    // The following code performs standard error-handling. 
 
    if (dwErrorCode != ERROR_EXTENDED_ERROR) 
    { 
        wsprintf((LPSTR) szError, "%s failed; \nResult is %ld", 
            lpszFunction, dwErrorCode); 
        wsprintf((LPSTR) szCaption, "%s error", lpszFunction); 
        MessageBox(hwnd, (LPSTR) szError, (LPSTR) szCaption, MB_OK); 
        return TRUE; 
    } 
 
    // The following code performs error-handling when the 
    // ERROR_EXTENDED_ERROR return value indicates that WNetGetLastError 
    // can retrieve additional information. 
 
    else 
    { 
        dwWNetResult = WNetGetLastError(&dwLastError, 
            (LPSTR) szDescription,  // buffer for error description 
            sizeof(szDescription), 
            (LPSTR) szProvider,     // buffer for provider name 
            sizeof(szProvider)); 
 
        if(dwWNetResult != NO_ERROR) { 
            wsprintf((LPSTR) szError, 
                "WNetGetLastError failed; error %ld", dwWNetResult); 
            MessageBox(hwnd, (LPSTR) szError, 
                "WNetGetLastError", MB_OK); 
            return FALSE; 
        } 
 
        wsprintf((LPSTR) szError, 
            "%s failed with code %ld;\n%s", 
            (LPSTR) szProvider, dwLastError, (LPSTR) szDescription); 
        wsprintf((LPSTR) szCaption, "%s error", lpszFunction); 
        MessageBox(hwnd, (LPSTR) szError, (LPSTR) szCaption, MB_OK); 
        return TRUE; 
    } 
} 
...
Рейтинг: 0 / 0
Поиск компов в сети ...
    #33467777
s666
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Простите так и не смог ?- В общем хана просто !
...
Рейтинг: 0 / 0
6 сообщений из 6, страница 1 из 1
Форумы / C++ [игнор отключен] [закрыт для гостей] / Поиск компов в сети ...
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]