Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Tech Help (http://zelaron.com/forum/forumdisplay.php?f=329)
-   -   question about c. (http://zelaron.com/forum/showthread.php?t=7731)

Demosthenes 2002-10-15 01:33 PM

question about c.
 
I'm pretty new to c programming so plz dont flame me if this is a newbie question but is there a way u could open a different program with an .exe extension w/ a c program.

like for example would this work?

fp = fopen("file.exe", ??);

ty for your help

Almata 2002-10-17 01:02 PM

This is C, a computer language...Anything will work, you just have to know how to devise the right scripts. There is a way for all.

WetWired 2002-10-17 01:56 PM

That would open the file. The question is if opening the file is really what you want to do.

Demosthenes 2002-10-17 02:30 PM

Well I run bots on my computer all day when I'm not at home and the new one crashes quite a bit. I was wanting to make a program that would just restart it for me everytime it turns off. This is my script:

#include <stdio.h>
FILE *fp;

int main(void)
{
fp = fopen("mephbot.exe", "???");

if(fclose(fp))
{
fp = fopen("mephbot.exe", "???");
}

return 0;
}


I was thinking that would do it but it does absolutely nothing...doesn't even start my program. Mephbot.exe is the name of the program I did check that and where I put the question marks I have tried many differen combos. Any help as to why this is not working would be helpful...thnx

drivehappy 2002-10-17 09:48 PM

VB is much nicer for writing these kind of programs, if you have it, Ill tell you how to write it.

WetWired 2002-10-18 06:53 AM

You want to execute, not open the program. I can't help you on that one if you're trying to do it in a DOS program. If you can use the windows API, look at ShellExecute and ShellExecuteEx .
And if you have computers with compilers at school (read CS lab), and they have VC++, and they have fortress or some other lock out program, I have the source for a very interesting, um, utillity that I wrote, that can, um, supliment the run box by convincing windows that text files are really executable without renaming them, yeah. (In other words, this source turns VC on a computer into a nice way to run WinAmp and such on computers that wouldn't normally allow it)

drivehappy 2002-10-20 08:56 AM

mjordan2nd: Tells us what compilers you have; straight c is old, and hard to work with.

Demosthenes 2002-10-20 10:34 AM

i have dev-c++ compiler.

MrRooster 2002-11-05 12:33 PM

mjordan2nd: Try this, should work in any c compiler that supports Win32. It'll run Notepad untill you quit it via the taskmanager.....

#include <windows.h>

int WINAPI WinMain(HINSTANCE handle,HINSTANCE dontcare,PSTR cli,int showflags);

int WINAPI WinMain(HINSTANCE handle,HINSTANCE dontcare,PSTR cli,int showflags) {
STARTUPINFO startup;
PROCESS_INFORMATION process;

GetStartupInfo(&startup); /* Just copy the current process startup info. */
do {
if (!CreateProcess("c:\\WINNT\\System32\\NotePad.EXE" ,NULL,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,N ULL,&startup,&process)) {
MessageBox(NULL,"Can't launch app.","Applauncher",MB_ICONWARNING|MB_OK);
exit(1); /* can't create process, die. */
}
WaitForSingleObject(process.hProcess,INFINITE); /* Wait for the process to die. */

} while (1);
return 0;
}

Demosthenes 2002-11-05 06:20 PM

thank u mr rooster...ill try it and c if it works, never done any windows programming so ill c...thank u


All times are GMT -6. The time now is 09:04 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.