C++ code help

ArmoArmo Mr. Nice Guy Is Dead,Only Aqua Remains Member
edited February 2005 in Internet & Media
hey whats up, im in the process of making a rombox for some old snes and other systems games

i want the system to be totally mouseless, so what i plan on doing is crating a exe in C++ and loading that into the autoexec.bat ( yea the rombox is running 98 lol )

as far as the C++ code is conserned, i havent had a C++ lesson in years and i just wanna try to get it right bofore i exterminate the rombox

so far in the code u have a small little selection menu to choose what emulator to launch depending on the # you enter. Is it possible that once a selection is made that the C++ prog actually launch the exe of the pathed emulator as such

if selection = 1;
then ( *launch the prog from the path )

lol probly a bit crude but gimme some credit its been like 5 years and im only needing this skill now lol

Comments

  • ArmoArmo Mr. Nice Guy Is Dead,Only Aqua Remains Member
    edited February 2005
    This is what i have so far, i havent finished getting VSC++ from my schools website yet so i dont know if it will work or come back with 10000's of errors
    can any 1 help me out??

    the libraries didnt like the lessthan and greaterthan symbols
    #include iostream.h
    #include shellapi.h
    //#include shell32.lib
    
    main ()
    {
      int slection
      int value = 4
    
    do
    {
    cout <<"==========================================================================="
    cout << "This menu will help you decide which game emulator you would like to play ";
    cout << "1. Will open the 1st and Roms ";
    cout << "2. Will open the 2nd and Roms ";
    cout << "3. Will open the 3rd Emulator and roms ";
    cout <<"==========================================================================="
    cin >> selection
    
    
    if selection = 1;
    	then ShellExecute(handle, "open", C:\GBA\1.exe, NULL, NULL SW_SHOWNORMAL);
    
    if selection = 2;
    	then ShellExecute(handle, "open", C:\SNES\2.exe, NULL, NULL SW_SHOWNORMAL);
    
    if selection = 3;
    	then ShellExecute(handle, "open", C:\MAME\3.exe, NULL, NULL SW_SHOWNORMAL);
    } while selection > value;
    
    return 0;
    }
    
  • JBJB Carlsbad, CA
    edited February 2005
    #include < iostream >
    #include < iomanip >
    
    using namespace std;
    
    int main()
    {
    	system("I:\\STUFF\\Zips\\550Mhz\\wins3id.exe");
    }
    
    worked fine for me using VS.NET 2003 on winXP where wins3id.exe is what i want to run. make sure to use double \\ for the folders. I had to put spaces between < and the libraries because of the code tag.
  • ArmoArmo Mr. Nice Guy Is Dead,Only Aqua Remains Member
    edited February 2005
    ok kool, will my if then statements work if i use that System parameter?
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited February 2005
    I'd do something like this:
    int selection = -1;
    int value = 4;
    cout <<"==================================================  =========================\n";
    cout << "This menu will help you decide which game emulator you would like to play\n";
    cout << "1. Will open the 1st and Roms\n";
    cout << "2. Will open the 2nd and Roms\n";
    cout << "3. Will open the 3rd Emulator and roms\n";
    cout <<"==================================================  =========================\n";
    while(1){
    [indent]
    cin >> selection;
    if(selection == 1) {
    //put the code here
    } else if (selection == 2) {
    //put the code here
    } else if (selection == 3) {
    //put the code here
    } else {
    cout << "Please enter a selection from 1-3\n";
    }
    [/indent]
    }
    

    Although I'm not sure if reading in a char with cin and then comparing it to an int will work. I mostly do JAVA.
  • JBJB Carlsbad, CA
    edited February 2005
    they should. Do what shwaip says, along with the header that i used.
  • GHoosdumGHoosdum Icrontian
    edited February 2005
    I would use a SWITCH/CASE structure (Or maybe SELECT? I forget which language is which...) instead of the IF/ELSE IF structure. Everything else is kosher in my book.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited February 2005
    it's switch/case for C++...but it doesn't really matter for only 3 options. If there were a bunch more, I'd say yeah, you're right.
  • a2jfreaka2jfreak Houston, TX Member
    edited February 2005
    No need to use C++.
    If it's simple like Press 1 for emulator X or 2 for emulator Y, then use a batch file.
  • ArmoArmo Mr. Nice Guy Is Dead,Only Aqua Remains Member
    edited February 2005
    a2jfreak wrote:
    No need to use C++.
    If it's simple like Press 1 for emulator X or 2 for emulator Y, then use a batch file.


    well it is that "simple" but i know more about C++ than i do about the basics about a batch file =\

    it was my frist intentions of doing it like that but i couldnt remember how to print the menu lol
  • a2jfreaka2jfreak Houston, TX Member
    edited February 2005
    echo
Sign In or Register to comment.