Ver Mensaje Individual
  #10 (permalink)  
Antiguo 18/01/2014, 11:51
Avatar de guzzano
guzzano
 
Fecha de Ingreso: julio-2010
Ubicación: Isla de Margarita
Mensajes: 162
Antigüedad: 13 años, 9 meses
Puntos: 13
Respuesta: Un problemita alguien? soy novato

Él lo que quiere hacer, si no entendí mal, y esto.

Código C:
Ver original
  1. #include <windows.h>
  2. #include <cstdlib>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main(int argc, char* argv[]) {
  8.     int delay = 0;
  9.     int positions = 0;
  10.     POINT cursorPos[256];
  11.     SetConsoleTitleA("Andromeda 0.1");
  12.     cout << "Bienvenido a Andromeda 0.1\n";
  13.     cout << "Tiempo que se tomara los clicks (en milisegundos): ";
  14.     cin >> delay;
  15.     de_nuevo:
  16.     cout << "1. Para agregar posicion presione F1\n";
  17.     cout << "2. Presione F3 para empezar\n";
  18.    
  19.     for(;; Sleep(200)) {
  20.         if(GetAsyncKeyState(VK_F1)) {
  21.             GetCursorPos(&cursorPos[positions]);
  22.             cout << "Posicion actual " << positions + 1 << ": " << cursorPos[positions].x << ' ' << cursorPos[positions].y << '\n';
  23.             positions += 1;
  24.         }
  25.         if(GetAsyncKeyState(VK_F3)) {
  26.             if(positions == 0) {
  27.                 GetCursorPos(&cursorPos[positions]);
  28.                 positions = 1;
  29.             }
  30.             break;
  31.         }
  32.     }
  33.  
  34.     cout << "Andromeda iniciado\n";
  35.     cout << "Presione F4 para detener\n";
  36.  
  37.     int pos = 0;
  38.     for(;;Sleep(delay)) {
  39.         if(GetAsyncKeyState(VK_F4))
  40.             goto de_nuevo;
  41.         SetCursorPos(cursorPos[pos % positions].x, cursorPos[pos % positions].y);
  42.         mouse_event(MOUSEEVENTF_LEFTDOWN, cursorPos[pos % positions].x, cursorPos[pos % positions].y, 0, 0);
  43.         mouse_event(MOUSEEVENTF_LEFTUP, cursorPos[pos % positions].x, cursorPos[pos % positions].y, 0, 0);
  44.         pos++;
  45.     }
  46.  
  47.     cout << "Gracias por utilizar Andromeda 0.1\n";
  48.     Sleep(10000);
  49.     return 0;
  50. }

Disculpen ese goto ahí, se puede hacer mejor. Solo como ejemplo a ver si es lo que te apetece lograr.