Results 1 to 6 of 6

Thread: Grrr. Damn FindNextFile

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Unhappy

    Okay I've checked 3 api sites and a book and they all say this works. Unfortunately I can't make a long value equal FindFirstFile or FindNextFile. Here's my code.
    Can someone make this work correctly? Btw it only grabs the first 2 files in this code, i'll add my loop later
    [code]
    #include <iostream.h>
    #include <windows.h>

    void main()
    {
    WIN32_FIND_DATA data;
    char search[] = "C:/windows/system/*.dll";
    long hsearch;
    hsearch = FindFirstFile("C:/windows/system/*.dll",&data);
    cout<<data.cFileName<<endl;
    FindNextFile(hsearch,&data);
    cout<<path<<data.cFileName<<endl;
    }
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    The FindFirstFile function returns a HANDLE not long. Use This:
    Code:
    WIN32_FIND_DATA data;
       char search[] = "C:/windows/system/*.dll";
       HANDLE hsearch;
    hsearch = FindFirstFile ( "C:/windows/system/*.dll",&data); 
       cout<<data.cFileName<<endl;
       FindNextFile(hsearch,&data);
       cout<<data.cFileName<<endl;
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    *Sigh*

    Thank you once again Vlatko. Is there a good resource for using the API in C++? I can use them fine in vb. Just its the C++ conversions that get me
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  4. #4
    Member Benjamin's Avatar
    Join Date
    Nov 2000
    Posts
    48
    Download the platform SDK from microsoft.
    that has documentation on almost all of the API's
    -Dennis
    [email protected]
    Ever stop to think, and forget to start again?


    The end justifies the means
    http://www.cfm-resources.com/d/dewrenn
    http://www.phpsquare.com

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Could you?

    Could you give me the link? I have HORRIBLE luck navigating the msdn site for anything
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Talking I meant..

    I meant what is the SDK you mean? I can't find one for C++ or API on msdn
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width