1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#include <iostream>
#include <cwchar>
#include <string>
#include <Windows.h>
using namespace std;
#include <shellapi.h>
#pragma comment(lib,"shell32.lib")
static HWND hBut;
#define ShellExecute;
char response;
string a;
int main()
{
cout << "Would you like to play a game? Y/N?";
cin >> response;
if (response == 'y');
cout << "What game would you like to play? Please type in exactly what the game is called including spaces, dashes, or capitalization.";
cin >> a;
WIN32_FIND_DATA file;
HANDLE search_handle=FindFirstFile("C:\\*",&file);
if (search_handle)
{
do
{
if(file.cFileName == a)
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
ShellExecute(handle, "find", <fully_qualified_path_to_folder>, NULL, NULL, 0);
ShellExecute(handle, NULL, <fully_qualified_path_to_folder>, NULL, NULL, SW_SHOWNORMAL);
{
std::cout << "Found the game you wanted to play!" << std::endl;
}
}while(FindNextFile(search_handle,&file));
FindClose(search_handle);
}
system("pause");
if (response == 'n')
cout << "Goodbye!";
//countdown
Sleep (1 * 1000);
cout << "5"<<endl;
Sleep (1 * 1000);
cout << "4"<<endl;
Sleep (1 * 1000);
cout << "3"<<endl;
Sleep (1 * 1000);
cout << "2"<<endl;
Sleep (1 * 1000);
cout << "1"<<endl;
Sleep (1 * 1000);
cout << "CIAO!\n"<<endl;
Sleep (1 * 1000);
return 0;
}
|