• 13
• 27
• 9
• 9
• 20

Coding a shortcut?

This topic is 4928 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hey guys im trying to mess around with diablo II and I want to make a .exe that will open DiabloII.exe can anybody help me out (ps this isnt for *hacking* i am just trying to learn C++ in as many ways as possible....this is actually for a lazy mans needs i want to be able to type something such as !log in game and have the program log everything I type in the game in a .txt file until i type like !stop; its so I can avoid alt+tabbing when i take down peoples emails and such. thanks!)

Share on other sites
Look up the following families of functions:
CreateProcess[Ex]
spawn
exec

Share on other sites
Quote:
 Original post by OluseyiLook up the following families of functions:CreateProcess[Ex]spawnexec

I recommend using the _exec-family, because the parameters actually WORK. I've had trouble using more than 1 parameter with the other functions.

Clicky!

Share on other sites
Or if you want to stay within the Standard you could try std::system(). It doesn't give you that much control but might be sufficient if you don't have complex needs.

- Pete

Share on other sites
No! No no no! USE _EXECx()!!
It's the best for launching games with parameters.

(Check my post aboce for a link!)

Share on other sites
Problem: std::system blocks the parent process, which means that you can start the subprogram and then continue work in the parent. The others are non-blocking. For Windows, I prefer CreateProcessEx because of the level of control it provides.

Share on other sites
i appreciate the responses but the description at the dev site is really confusing...can anybody give me a somewhat "lame-mans" example/explanation? thanks :)

Share on other sites
// crt_args.c/* Illustrates the following variables used for accessing * command-line arguments and environment variables: * argc  argv  envp * This program will be executed by crt_exec which follows. */#include <stdio.h>int main( int argc, /* Number of strings in array argv */ char *argv[],       /* Array of command-line argument strings */ char **envp )       /* Array of environment variable strings */{    int count;    /* Display each command-line argument. */    printf( "\nCommand-line arguments:\n" );    for( count = 0; count < argc; count++ )        printf( "  argv[%d]   %s\n", count, argv[count] );    /* Display each environment variable. */    printf( "\nEnvironment variables:\n" );    while( *envp != NULL )        printf( "  %s\n", *(envp++) );    return;}

.. is from that website. But it got scrambled, so I copied it and pasted it here. It's cool here.

[VERY LATE edit] Oh now I see it's wrong code.

[Edited by - Pipo DeClown on September 16, 2004 12:18:24 PM]

Share on other sites
im still confused....how would i implement that with opening d2.exe? (im sort of new to working with files)