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();
         
         }

Dani AI

Generated

As is learning C++, the right next step is to keep building language fundamentals and then pick up a small set of Win32 topics that let you automate another program reliably. 's suggestion to start the target process and get a handle is the correct direction; once you have that handle you have two practical automation paths: synthesize real keyboard input, or talk to the target's controls directly via UI automation/message APIs.

A safe practice ladder: (1) finish the C++ basics, (2) write a tiny launcher that starts Notepad and waits for its window, (3) use FindWindow/SetForegroundWindow and try sending keystrokes with SendInput to learn timing and focus issues, (4) try directly setting an edit control's text (where allowed) or move up to Microsoft UI Automation for more robust control. If you want rapid prototyping, scripts like AutoHotkey let you test sequences without writing C++ first.

Troubleshooting notes and cautions: many apps block programmatic input (secure fields, elevated processes, or custom-drawn UIs). Timing and focus are the common failures—insert waits and verify window readiness. Privilege mismatches (your process vs. the target) can prevent automation; avoid injecting into elevated processes. Automating credentials is fragile and a security risk—prefer official APIs or stored credential mechanisms when available.

Further reading and tools: Microsoft’s overview of processes and threads and the SendInput documentation are good starting references (Processes and threads, SendInput). For higher-level UI work see the Windows Automation API overview (Windows Automation API overview). For quick experiments, AutoHotkey is useful (AutoHotkey). For books, Charles Petzold’s material is a solid introduction to Win32 fundamentals.

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.