views:

211

answers:

3

Hello

This time I have a question about C++. I'm using Dev-C++ for programming, but I also have Visual C++ Express installed so both are good. I'm creating a program like automated tasks, is it.. macro? But as I'm a noob in C++, because I started it a week ago, I need help. Please keep the answers simple :-D This is a part of my learning-progress in C++.

Also, I tried to Google these for a long time without success, so I'd not like to hear answers relating to searching.

How is it possible to move cursor around the screen? This should be possible, as everything is, but is there any simple way/function to do this. I also need to click mouse-buttons.

This one must be a simple one: Pressing keys. I have nothing to add into this.

Hope you can help., Martti Laine

A: 

You can use keybd_event function from Windows API. For example:

HWND hwnd = FindWindowA(NULL,"Untitled - Notepad");
AppActivate(hwnd);
keybd_event(VkKeyScan('A'), 0, 0, 0);
mloskot
A: 

If you're writing to the console, you'd rather use something like conio.h or curses.

Kornel Kisielewicz
A: 

Since you feel that you are at noob level at this point, I believe that the simplest path for you is to build a Console Application, using a curses library. It is not a perfect solution, but the learning curve is less steep, and once you master it the learning curve to more gui like methods should be less steep.

EvilTeach