Need to learn how to search using visual c++ 6

Posted on 2005-03-21
Medium Priority
Last Modified: 2010-08-05

I am a very new programmer i have made a few very small programs for friends.. but i am currently trying to advance my skills and test myself as well as helping friends by making a program that goes through their computers and looks for files.. (eg. norton, internet security, firewalls, codecs, temp files, cookies, reg files, amd then suggest where to get updates and certain codecs and weather they should get antiviruses so on so forth)


Can someone supply me with the filesearching code (i have no idea so please document) including all headers needed etc etc..and if u want the code to search through reg files.. or if ur feeling lazy even reccomend a site with a link.. all i want to do is learn and test my skills.. any help appreciated

i have given top points ranking for this
any probs u can email me @        wazzup_scott01@hotmail.com
Question by:Scott Thomson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 16

Accepted Solution

nonubik earned 2000 total points
ID: 13590193
Here's a function that search through a given folder name (and its subfolders) the reg files:

void DoIt(LPCTSTR szDir)
  CFileFind   Finder;
  CString     strPath(szDir);
  strPath += "\\*.reg";
  BOOL bFind = Finder.FindFile(strPath);
    bFind = Finder.FindNextFile();
    // skip . and .. files; otherwise, we'd
    // recur infinitely!

    // if it's a directory, recursively search it
    if (Finder.IsDirectory())
      //Use Finder.GetFilePath() to get the path. Copy file after extension check here.

This code uses MFC, so no other additional includes are necessary.
LVL 10

Author Comment

by:Scott Thomson
ID: 13590329
the code works (compiles with no errors..

and i will award u points but also can u perhaps explain a little... simpler (im an idiot)

perhaps where to put the directory or weather this is user input generated.. and does it search registry.. prolly not..

once again thanks and any help appreciated
LVL 16

Expert Comment

ID: 13590407
The above function takes as inpunt a folder name. You can use it like:


and it will search all .reg files on C:\. But of course this can take quite a long time.
I'm not sure if you want to search for the .reg files or to search through the registry.
To search through the registry you'll need to use Registri functions: RegCreateKeyEx, RegQueryValueEx, RegCloseKey, etc. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry_functions.asp)
LVL 10

Author Comment

by:Scott Thomson
ID: 13590422
awesome man.. purely awesome

id love to be as good as you..
u must have a kick ass programming job or something

thanks it works awesomely

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question