Server Help

Non-Subspace Related Coding - help with c++

hellzlaker - Sat Mar 08, 2008 10:42 pm
Post subject: help with c++
im trynna make a program that opens the following windows but i have a problem, it opens the first window (subbill) and turns others for like 1 second and closes them

here is the code
Code: Show/Hide
          else if (option == "run")
          {
               cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
               cout<<"Feature is being worked on \n";
               system("pause");
               ShellExecute(NULL, "open", "server\\Subbill.exe", NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               ShellExecute(NULL, "open", "server\\subgame2.exe",NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               ShellExecute(NULL, "open", "bot\\MERVbot.exe",NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               ShellExecute(NULL, "open", "bot1\\MERVbot.exe",NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               ShellExecute(NULL, "open", "bot1\\MERVbot.exe",NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               
               return main();
          }


can you tell me why is it happening and how to fix it?
tcsoccerman - Sat Mar 08, 2008 11:16 pm
Post subject:
does it open for more than a second when you open it normally(double clicking)?
hellzlaker - Sat Mar 08, 2008 11:41 pm
Post subject:
? no but i did sleep(3000) just to make sure since i thought maybe timing was the problem, but do you know why all other programs close except for subbill?
Bak - Sun Mar 09, 2008 6:09 am
Post subject:
when you double click on them in that order, do they stay open?
Animate Dreams - Mon Mar 10, 2008 1:40 pm
Post subject:
Can you even call Sleep() if you're not a thread?
Doc Flabby - Mon Mar 10, 2008 1:44 pm
Post subject:
Animate Dreams wrote:
Can you even call Sleep() if you're not a thread?

You are always in a Thread icon_smile.gif

Code: Show/Hide

HINSTANCE ShellExecute(     
    HWND hwnd,
    LPCTSTR lpOperation,
    LPCTSTR lpFile,
    LPCTSTR lpParameters,
    LPCTSTR lpDirectory,
    INT nShowCmd
);



They are probably closing because he has not provided the working directory. Which means they cant find the files they are looking for.
Animate Dreams - Mon Mar 10, 2008 1:45 pm
Post subject:
Crap... are we getting philosophical? If so, it's going over my head :(
hellzlaker - Tue Mar 11, 2008 5:07 pm
Post subject:
Bak wrote:
when you double click on them in that order, do they stay open?



yes they do stay open

Quote:
They are probably closing because he has not provided the working directory. Which means they cant find the files they are looking for.


no it finds it and opens it up, and it says subgame and the bots do open they just close a second later but you get a chance to see what it says
tcsoccerman - Tue Mar 11, 2008 5:32 pm
Post subject:
maybe the program has a problem with how you're opening it? just a guess.
Doc Flabby - Tue Mar 11, 2008 5:47 pm
Post subject:
hellzlaker wrote:
[..]
no it finds it and opens it up, and it says subgame and the bots do open they just close a second later but you get a chance to see what it says


The working directory is not subgame2.exe. Its the directory subgame is in. You need to reference it,so it loads properly, when you run shell execute put the folder subgame where lpDirectory goes.


Example
Code: Show/Hide

ShellExecute(NULL, "open", "server\\subgame2.exe",NULL, "server\\", SW_SHOWNORMAL);
[/code]
Purge - Tue Mar 11, 2008 6:48 pm
Post subject: Re: help with c++
hellzlaker wrote:
im trynna make a program that opens the following windows but i have a problem, it opens the first window (subbill) and turns others for like 1 second and closes them

here is the code
Code: Show/Hide
          else if (option == "run")
          {
               cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
               cout<<"Feature is being worked on \n";
               system("pause");
               ShellExecute(NULL, "open", "server\\Subbill.exe", NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               ShellExecute(NULL, "open", "server\\subgame2.exe",NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               ShellExecute(NULL, "open", "bot\\MERVbot.exe",NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               ShellExecute(NULL, "open", "bot1\\MERVbot.exe",NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               ShellExecute(NULL, "open", "bot1\\MERVbot.exe",NULL, NULL, SW_SHOWNORMAL);
               Sleep(3000);
               
               return main();
          }


can you tell me why is it happening and how to fix it?


Can you actually compare strings with an equalto in C++? I know you can in Java, but I thought in C++ you have to use a function like strcmp() or something.

If not, I'm surprised it goes through the loop.
Mine GO BOOM - Tue Mar 11, 2008 6:57 pm
Post subject:
If it is a string class, the == is overloaded to work.
Dr Brain - Tue Mar 11, 2008 11:00 pm
Post subject:
Note: You shouldn't use == in Java, since it's not guaranteed to work (but usually does because of internal stuff), especially with strings from external sources.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group