Now that I have working program starter, are there any simple methods of filling in the info to it? I just have the base of it set up and I am not sure how to set up the self-typer.

If there are any tutorials made for handling things like this please link me or if you have some time and are willing to help, please do.

Here is the base:

#include <iostream>
#include <windows.h>
using namespace std;

int main()
{
            cout << "Starting Steam...\n\n";
            system("\"C:/Program Files/Steam/steam.exe\"");
            

    
}
         
         cin.get();
         cin.get();
         
         }

Recommended Answers

All 6 Replies

What operating system? Under MS-Windows you can't achieve that goal with the system() function because it doesn't return anything about the process that was started -- steam.exe in your example post. Instead, use win32 api function CreateProcess(). The last parameter will be filled in with the information you need to pass that process messages, such as dumping keystrokes into its keyboard buffer.

STARTINFO sinfo;
PROCESS_INFORMATION pinfo;
memset(&sinfo, 0, sizeof(STARTINFO);
sinfo.cb = sizeof(STARTINFO);
BOOL bVal = CreateProcess(NULL, 
          "C:/Program Files/Steam/steam.exe",0,0,0,0,0,0,&sinfo, &pinfo);

Be sure to initialize the STARTINFO structure as shown above because if you don't CreateProcess() will probably fail.

Hmm thats definitely out of my range of knowledge at the moment... Do you know of a good way to practice/learn how to do this?


My current book doesn't even have "STARTINFO" or "PROCESS_INFORMATION" anywhere in the entire book.

You are probably reading the wrong book. You need to buy a book about MS-Windows programming. And yes, it is not for beginners, you need a good basic understanding of C or C++ languages.

You can save yourself some time with this intoduction tutorial. It is by all means not complete -- it only introduces you to a few concepts.

>>My current book doesn't even have "STARTINFO" or "PROCESS_INFORMATION
Look up CreateProcess at www.microsoft.com. Just enter that in its search box and it will give you several links. That link will describe those structures.

commented: Nice post =) +1

I am reading "C++ Primer Plus" right now and it is a very high grade, descriptive book on C++. The only problem that comes with that is the shier amount of reading needed to understand each concept. I have skipped ahead here and there just to try and keep myself motivated on learning C++ but I don't think a new book is in order is it?

>>but I don't think a new book is in order is it?
What you have is a book about C++ programming. Finish studying that book before attempting something more advanced such as MS-Windows programming. You should do all the exercises at the end of each chapter to insure you understand the material covered.

When you have finished that book you will probably be ready for a book about MS-Windows programming. Windows programming is not another language -- its still C and C++, but it has a lot of new concepts and techniques you need to learn.

Oh that would make sense as to why the code you wrote didn't look right...

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.