leichte Anfängerfrage

10/01/2014 13:03 .Banger.'#1
Hey,
ich habe erst mi C++ begonnen und habe mal eine frage:
Ich möchte etwas "programmieren" das schlicht und einfach immer nur in einem Abstand von 0,5 sec. die Taste "Y" drückt.
Kann mir jemand sagen wie ich das Programmieren kann?


Liebe Grüße
10/01/2014 13:05 nRy#2
Cc /command y t- 0.5
10/01/2014 17:17 Terrat#3
Hilf den armen Junge doch:

Sende eine Taste zu einen Fenster:
[Only registered and activated users can see links. Click Here To Register...]



Zeit abwarten:
[Only registered and activated users can see links. Click Here To Register...]

Schleifen:
[Only registered and activated users can see links. Click Here To Register...]
10/01/2014 17:31 Tartaros96#4
Ein Liste aller Keycodes in Windows:
[Only registered and activated users can see links. Click Here To Register...]

Code:
//
// keystroke.c - Pauses, then simulates a key press
// and release of the "A" key.
//
// Written by Ted Burke - last updated 17-4-2012
//
// To compile with MinGW:
//
//      gcc -o keystroke.exe keystroke.c
//
// To run the program:
//
//      keystroke.exe
//
// ...then switch to e.g. a Notepad window and wait
// 5 seconds for the A key to be magically pressed.
//
 
// Because the SendInput function is only supported in
// Windows 2000 and later, WINVER needs to be set as
// follows so that SendInput gets defined when windows.h
// is included below.
#define WINVER 0x0500
#include <windows.h>
 
int main()
{
    // This structure will be used to create the keyboard
    // input event.
    INPUT ip;
 
    // Set up a generic keyboard event.
    ip.type = INPUT_KEYBOARD;
    ip.ki.wScan = 0; // hardware scan code for key
    ip.ki.time = 0;
    ip.ki.dwExtraInfo = 0;
	
	do {
		// Press the "A" key
		ip.ki.wVk = 0x41; // virtual-key code for the "a" key
		ip.ki.dwFlags = 0; // 0 for key press
		SendInput(1, &ip, sizeof(INPUT));
	 
		// Release the "A" key
		ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
		SendInput(1, &ip, sizeof(INPUT));
		Sleep(1000)
	} while(true);
	
 
    // Exit normally
    return 0;
}
Gefunden unter: [Only registered and activated users can see links. Click Here To Register...]
10/02/2014 15:51 .Banger.'#5
Danke euch :)
10/03/2014 16:32 Terrat#6
hab ihn was gebastelt kann geschlosen werden ;D
10/07/2014 23:17 yellow_bannana#7
Ich weiß du willst nicht das hören, aber ist es für Metin 2 gedacht?
10/14/2014 09:59 IchBin<<#8
Wird höchstwahrscheinlich von deinem AV Programm als Virus erkannt werden... Wenn es global passieren soll
10/16/2014 01:55 Terrat#9
Xd hab es schon für ihn gemacht ,lernt lesen und meins ist global und 0/55
10/16/2014 09:14 Schlüsselbein#10
Dann poste es hier öffentlich. Wenn der TS seine Lösung hat, sollten auch andere Leute die auf den Thread hier stoßen die Lösung sehen können.