• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 540
  • Last Modified:

FindFirstFile/FindNextFile/FindClose

FindFirstFile/FindNextFile/FindClose
How do I use these three functions or other functions to get the directories and files on a server. And how do I see them in the client ? What are the steps from getting the directories and files to sending and receiving and displaying on the client. A briefly explaination on the steps please. Some codes would be nice too.
0
redhat092798
Asked:
redhat092798
1 Solution
 
redhat092798Author Commented:
Edited text of question.
0
 
wyllikerCommented:
Pretty straight forward ...

// when looking at network file shares you will use UNC
// that looks like ... hard-coded example below

// Substitute COMPUTERNAME with a computer name from your
// network. Substitute Share with the name of a share on
// that computer!

char * UNCPath = "//COMPUTERNAME/Share/*.*";
HANDLE hFindFile = (HANDLE) NULL;
WIN32_FIND_DATA FindFileInfo;

hFindFile = FindFirstFile(UNCPath, &FindFileInfo);
if(hFindFile)
{
    do
    {
      // Here you can get ahold of any of the values of
      // the WIN32_FIND_DATA data structure
      // Read the help info on this structure to see what
      // info is available to you

      // Load up any controls - list boxes, list controls,
      // tree controls, combo boxes etc with the filename
      // or directory name, for example.

    } while(FindNextFile(hFindFile, &FindFileInfo);

    FindClose(hFindFile);
    hFindFile = (HANDLE) NULL;
}





0
 
redhat092798Author Commented:
I'm more interested on how and at which point do I send() to the client . And on the client side. How do I display this info in a listbox. Sorry for the slight turn in the question but I did ask for that in my original queston.
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
redhat092798Author Commented:
I'm more interested on how and at which point do I send() to the client . And on the client side, how do I recv() and display this info in a listbox. Sorry for the slight turn in the question but I did ask for that in my original queston.
0
 
PinTailCommented:
FindXXX are not remote processes, they are running on your local machine, it's just that they are looking at a remote machines directory structure.  Since this is the case, the server doesn't 'send' anything, the client 'retrieves' ( although the client is making use of the servers file system, so in reality the server is 'sending', but programatically - with FindXXX - it is not ).


How you display the data enumerated from FindXXX is your business

send() and recv() ??? are you trying to use sockets for this.


0
 
leflonCommented:
don' t send all the information from your server to your clients. just tell the clients which shared directory (or a subdirectory of a shared one) to scan.
so the client gets UNC path and here just follow what wylliker proposed.
if your question is about client/server communication, thats another story.
0
 
redhat092798Author Commented:
My question is about client/server situation over internet. Not on a LAN or a WAN.
Sorry for not being more clear.
0
 
wyllikerCommented:
If you are talking about using the internet, if you are specifically using this for FTP then you can use

FtpFindFirstFile - see the docs on this call it is different from FindFirstFile - it also fills in a WIN32_FIND_DATA structure.

Follow this call in your loop for InternetFindNextFile.

You will need to establish an internet connection using the WinInet API first.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now