WIN32_FIND_DATA FindFileData; HANDLE hFind; LPSECURITY_ATTRIBUTES attr; hFind = FindFirstFile("*thefile.exe", &FindFileData); if (hFind == INVALID_HANDLE_VALUE) { // Error == No files were found MessageBox("Invalid File Handle.\r\nNo files were found in the directory"); } else { //the name m_FileFound = FindFileData.cFileName; }