Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "StdAfx.h"
- #include <iostream>
- #include <string>
- #include <stdio.h>
- #include <windows.h>
- #include "Shellapi.h"
- #pragma comment(lib,"shell32.lib")
- using namespace std;
- int main ()
- {
- SetConsoleTitleA("C to the UNIT's Steam Game Launcher");
- string input;
- 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";
- cin >> input;
- do
- {
- if (input == "Gmod" || input == "gmod")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/4000"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Garry's Mod is now running!";
- return 0;
- }
- else if (input == "EP1" || input == "Ep1")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/380"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Half-Life 2:Episode 1 is now running!";
- return 0;
- }
- else if (input == "EP2" || input == "Ep2")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/420"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Half-Life 2:Episode 2 is now running!";
- return 0;
- }
- else if (input == "TF2" || input == "Tf2")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/440"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Team Fortress 2 is now running!";
- return 0;
- }
- else if (input == "HL2:DM" || input == "Hl2:dm")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/320"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Half-Life 2:Death Match is now running!";
- return 0;
- }
- else if (input == "HL2" || input == "Hl2")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/220"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Half-Life 2 is now running!";
- return 0;
- }
- else if (input == "HL1" || input == "Hl1")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/70"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Half-Life 1 is now running!";
- return 0;
- }
- else if (input == "Portal" || input == "portal")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/400"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Portal is now running!";
- return 0;
- }
- else if (input == "CS:S" || input == "Cs:s")
- {
- ShellExecute(NULL, _T("open"), _T("steam://rungameid/240"), NULL, NULL, SW_SHOWNORMAL);
- cout << "Counter-Strike:Source is now running!";
- return 0;
- }
- else
- {
- MessageBox(NULL, _T("That is not a valid input, please input a correct choice."), _T("Error"), 0);
- return 0;
- //cin >> input;
- //continue; //Check again
- }
- }
- while (false);
- cin.get();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement