Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

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


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
Scott Thomson
Scott Thomson
  • 2
  • 2
1 Solution
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.
Scott ThomsonAuthor Commented:
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
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)
Scott ThomsonAuthor Commented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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