How to find out remote files?
-
Is there anybody knows how to find the names of the shared files and folders on a remote computer like "network neighborhood" does? "FindFirstFile" function doesnt seem to work. Maybe the path i use is not correct or it doesnt work at all on the subject. Ex: FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) PS: And more... Im very curios to find out how "network neighborhood" manages to obtain those shared files and folders? What's the mechanism it use? :eek: Thank you.
-
Is there anybody knows how to find the names of the shared files and folders on a remote computer like "network neighborhood" does? "FindFirstFile" function doesnt seem to work. Maybe the path i use is not correct or it doesnt work at all on the subject. Ex: FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) PS: And more... Im very curios to find out how "network neighborhood" manages to obtain those shared files and folders? What's the mechanism it use? :eek: Thank you.
FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) You're missing a slash at the beginning (well, two actually): FindFirstFile("\\\\Comp_name\\fold_name\\*.*" ,.....) --Mike-- http://home.inreach.com/mdunn/ "The Earth is doomed." -- Rupert Giles :love: your :bob: with :vegemite: and :beer:
-
Is there anybody knows how to find the names of the shared files and folders on a remote computer like "network neighborhood" does? "FindFirstFile" function doesnt seem to work. Maybe the path i use is not correct or it doesnt work at all on the subject. Ex: FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) PS: And more... Im very curios to find out how "network neighborhood" manages to obtain those shared files and folders? What's the mechanism it use? :eek: Thank you.
FindFirstFile(\\\\Comp_name\\fold_name\\*.*" ,.....). I still dont get how this function works...
-
FindFirstFile(\\\\Comp_name\\fold_name\\*.*" ,.....). I still dont get how this function works...
FindFirstFile returns a handle, so one's code would look like this... (a snipped from my production code) WIN32_FIND_DATA fd; CString sQualifier = sPath; sQualifier += _T("\\*.*"); HANDLE hFindFile = FindFirstFile(sQualifier, &fd); BOOL bBool = hFindFile == INVALID_HANDLE_VALUE ? FALSE : TRUE; if (!bBool) return FALSE; int i=0; while (bBool) { if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { listFiles.insert(FileList::value_type(fd.cFileName, fd)); i++; } bBool = FindNextFile(hFindFile, &fd); } Norm Almond Chief Technical Architect FS Walker Hughes Limited
-
Is there anybody knows how to find the names of the shared files and folders on a remote computer like "network neighborhood" does? "FindFirstFile" function doesnt seem to work. Maybe the path i use is not correct or it doesnt work at all on the subject. Ex: FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) PS: And more... Im very curios to find out how "network neighborhood" manages to obtain those shared files and folders? What's the mechanism it use? :eek: Thank you.
FindFirstFile("\\Comp_name\\fold_name\\*.*",... ) works fine. But FindFirstFile("\\Comp_name\\*.*,...) doesnt return anything...:mad: Then i started the "Command Prompt" and type "dir \\comp_name" and i got the following message:" The share name was not found" !!!!! i also mention that in Command prompt the following works fine: "dir \\comp_name\\fold_name" !!!! If i type in Command prompt "NET VIEW \\comp_name" i get exactly what i want. Try yourself if you think i'm jocking. So, how do i find out the parent directories on a remote computer (in my application, of course)? Thank you... again:
-
FindFirstFile returns a handle, so one's code would look like this... (a snipped from my production code) WIN32_FIND_DATA fd; CString sQualifier = sPath; sQualifier += _T("\\*.*"); HANDLE hFindFile = FindFirstFile(sQualifier, &fd); BOOL bBool = hFindFile == INVALID_HANDLE_VALUE ? FALSE : TRUE; if (!bBool) return FALSE; int i=0; while (bBool) { if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { listFiles.insert(FileList::value_type(fd.cFileName, fd)); i++; } bBool = FindNextFile(hFindFile, &fd); } Norm Almond Chief Technical Architect FS Walker Hughes Limited
I knew all the things you tell me.Thanx, anyway.In fact wanted to ask something else... I meant how does a function on my computer like FindFirstFile managed to find out the shared resource on a remote computer? From where that function collects theese informations? What network protocol theese function use? Why do i ask all theese questions? Just because i want to write a project... I want collect from my LAN how many information i can. All theese informations i want to monitorize on my computer. If i write a socket based client on every computer and a server on my computer then the problem is solved. BUT, I WANT TO WRITE A SINGLE APPLICATION ON MY COMPUTER IN ORDER TO GATHER INFORMATION FROM ALL COMPUTER IN MY NETWORK, ABOUT:IP ADDRESS, PROCESSES, MAC ADDRESS, FREE SPACE ON HARDDRIVES, AND MANY MANY OTHERS. Of course, i make use of SNMP (MIBII) BUT ONLY LOCAL. I dont know how to access SNMP information on remote computer. I hope i wasnt boring and i made myself clear.
-
I knew all the things you tell me.Thanx, anyway.In fact wanted to ask something else... I meant how does a function on my computer like FindFirstFile managed to find out the shared resource on a remote computer? From where that function collects theese informations? What network protocol theese function use? Why do i ask all theese questions? Just because i want to write a project... I want collect from my LAN how many information i can. All theese informations i want to monitorize on my computer. If i write a socket based client on every computer and a server on my computer then the problem is solved. BUT, I WANT TO WRITE A SINGLE APPLICATION ON MY COMPUTER IN ORDER TO GATHER INFORMATION FROM ALL COMPUTER IN MY NETWORK, ABOUT:IP ADDRESS, PROCESSES, MAC ADDRESS, FREE SPACE ON HARDDRIVES, AND MANY MANY OTHERS. Of course, i make use of SNMP (MIBII) BUT ONLY LOCAL. I dont know how to access SNMP information on remote computer. I hope i wasnt boring and i made myself clear.
-
I think the Windows Networking (WNet) functions could be what you need. See the Platform SDK docs under Networking and Directory Services/Network Management.
WNet is exactly what i was thinking about! i discovered WNet looking at "Computers enumeration" article. Now that you told me about WNet i have more trust in it. I have to say my WNet knowledge is zero. Did you actualy use WNet on your projects? Do you know some articles except MSDN ones? Thank you a lot! :rose: