Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.65 KB | None | 0 0
  1. #include "StdAfx.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <stdio.h>
  5. #include <windows.h>
  6. #include "Shellapi.h"
  7. #pragma comment(lib,"shell32.lib")
  8. using namespace std;
  9.  
  10. int main ()
  11. {    
  12.     SetConsoleTitleA("C to the UNIT's Steam Game Launcher");
  13.     string input;
  14.  
  15.     cout << "Please type the name of the game you would like to play below(Gmod, EP1, EP2, TF2, HL2:DM, HL2, HL1, Portal, or CS:S:\n";
  16.     cin >> input;
  17.  
  18.     do
  19.     {
  20.         if (input == "Gmod" || input == "gmod")
  21.         {
  22.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/4000"), NULL, NULL, SW_SHOWNORMAL);
  23.             cout << "Garry's Mod is now running!";
  24.             return 0;
  25.         }
  26.         else if (input == "EP1" || input == "Ep1")
  27.         {
  28.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/380"), NULL, NULL, SW_SHOWNORMAL);
  29.             cout << "Half-Life 2:Episode 1 is now running!";
  30.             return 0;
  31.         }
  32.         else if (input == "EP2" || input == "Ep2")
  33.         {
  34.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/420"), NULL, NULL, SW_SHOWNORMAL);
  35.             cout << "Half-Life 2:Episode 2 is now running!";
  36.             return 0;
  37.         }
  38.         else if (input == "TF2" || input == "Tf2")
  39.         {
  40.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/440"), NULL, NULL, SW_SHOWNORMAL);
  41.             cout << "Team Fortress 2 is now running!";
  42.             return 0;
  43.         }
  44.         else if (input == "HL2:DM" || input == "Hl2:dm")
  45.         {
  46.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/320"), NULL, NULL, SW_SHOWNORMAL);
  47.             cout << "Half-Life 2:Death Match is now running!";
  48.             return 0;
  49.         }
  50.         else if (input == "HL2" || input == "Hl2")
  51.         {
  52.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/220"), NULL, NULL, SW_SHOWNORMAL);
  53.             cout << "Half-Life 2 is now running!";
  54.             return 0;
  55.         }
  56.         else if (input == "HL1" || input == "Hl1")
  57.         {
  58.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/70"), NULL, NULL, SW_SHOWNORMAL);
  59.             cout << "Half-Life 1 is now running!";
  60.             return 0;
  61.         }
  62.         else if (input == "Portal" || input == "portal")
  63.         {
  64.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/400"), NULL, NULL, SW_SHOWNORMAL);
  65.             cout << "Portal is now running!";
  66.             return 0;
  67.         }
  68.         else if (input == "CS:S" || input == "Cs:s")
  69.         {
  70.             ShellExecute(NULL, _T("open"), _T("steam://rungameid/240"), NULL, NULL, SW_SHOWNORMAL);
  71.             cout << "Counter-Strike:Source is now running!";
  72.             return 0;
  73.         }
  74.         else
  75.         {
  76.             MessageBox(NULL, _T("That is not a valid input, please input a correct choice."), _T("Error"), 0);
  77.             return 0;
  78.             //cin >> input;
  79.            //continue; //Check again
  80.         }
  81.     }
  82.      while (false);
  83.  
  84.     cin.get();
  85.     cin.get();
  86.    
  87.     return 0;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement