Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ help needed on sending keystrokes

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
NuclearPowered
Master Cheater
Reputation: 0

Joined: 30 Dec 2007
Posts: 345

PostPosted: Wed Feb 27, 2008 9:07 am    Post subject: C++ help needed on sending keystrokes Reply with quote

Code:

    loop:
    if(GetAsyncKeyState(VK_F12))
    {
        cout << "Lololol";
        Sleep(1000);
    }
    if(GetAsyncKeyState(VK_F11))
    {
        return 0;
    }
    goto loop;
}


What I want it to do is when I press F12 it types "You got roflmayonaise" and then presses enter.
I added the sleep to prevent it from sending lololol 5000x when I just hold F12 for 10 milliseconds...
Also I need a better way of looping because I heard using goto is really bad.
I checked up SendInput on msdn but I dont understand microsoft language :/
All help is appreciated.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Feb 27, 2008 9:51 am    Post subject: Reply with quote

while (0)
{

}

for (;Wink
{

}
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Feb 27, 2008 10:00 am    Post subject: Reply with quote

while(TRUE)

same as

while(1)

never tried while(0)...

or

#define EVER ;;

for(EVER)
{
}
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Feb 27, 2008 10:05 am    Post subject: Re: C++ help needed on sending keystrokes Reply with quote

NuclearPowered wrote:
Code:

    loop:
    if(GetAsyncKeyState(VK_F12))
    {
        cout << "Lololol";
        Sleep(1000);
    }
    if(GetAsyncKeyState(VK_F11))
    {
        return 0;
    }
    goto loop;
}


What I want it to do is when I press F12 it types "You got roflmayonaise" and then presses enter.
I added the sleep to prevent it from sending lololol 5000x when I just hold F12 for 10 milliseconds...
Also I need a better way of looping because I heard using goto is really bad.
I checked up SendInput on msdn but I dont understand microsoft language :/
All help is appreciated.


Yes, goto is bad. Also make a way to exit, since I'm assuming you're using a thread to do GetAsyncKeyState.

Also also, try this: http://www.codeproject.com/KB/cpp/togglekeys.aspx
Back to top
View user's profile Send private message
systat
Advanced Cheater
Reputation: 0

Joined: 15 Feb 2008
Posts: 54

PostPosted: Wed Feb 27, 2008 1:02 pm    Post subject: Reply with quote

Code:
void SendSpam(string Txt) {
  for(int i=0;i<Txt.length();i++) {
        keybd_event(BYTE(VkKeyScan(Txt[i])),0,0,0);
      
    }
  keybd_event(VK_RETURN,0,0,0);
}


There you go, multifunctional spammer.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Feb 28, 2008 5:49 am    Post subject: Reply with quote

Where are you trying to send the key strokes to? Or just type it to a console window?
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites