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++]How to make a configurable key to spam?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Hieroglyphics
I post too much
Reputation: 0

Joined: 06 Dec 2007
Posts: 2007
Location: Your bedroom

PostPosted: Sun Jul 27, 2008 5:34 pm    Post subject: [C++]How to make a configurable key to spam? Reply with quote

How can I make it so that users can change the key that will be spammed in the bot/trainer I am making this is what I have I already have the part for the window and I am using this postmessage:

Code:
if(GetAsyncKeyState(VK_F9))
         {
         PostMessage(hGhostOnline, WM_KEYDOWN, 0x5A, NULL);
         }


I need to know how they can type in a key after pressing F9 and then it will spam that key instead of a set key.

BTW it is a console DLL

_________________

Back to top
View user's profile Send private message AIM Address MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Jul 27, 2008 5:52 pm    Post subject: Reply with quote

Somehow via Window controls (like Edit,ComboBox,ListBox,etc.) Allow the user input to the selected key.

For the hotkey's/send keys other then single characters you'll have to actually switch through.

If its a single character such as a, b, c, d, ', ;, etc. You can just use VkKeyScan

Code:
// Get the text from the box's/whatever control you used.
// Utilize VkKeyScan like this:
// or switch through texts and assign the dwHotkey/dwSendKey certain values.
DWORD dwHotkey  = LOWORD( VkKeyScan( tszHotkey[0] ) );
DWORD dwSendKey = LOWORD( VkKeyScan( tszSendKey[0] ) );
if ( GetAsyncKeyState( dwHotkey ) )
{
        PostMessage( hGhostOnline, WM_KEYDOWN, dwSendKey, NULL );
}

_________________
Back to top
View user's profile Send private message
Hieroglyphics
I post too much
Reputation: 0

Joined: 06 Dec 2007
Posts: 2007
Location: Your bedroom

PostPosted: Sun Jul 27, 2008 5:56 pm    Post subject: Reply with quote

How about something like this:

Code:

DWORD dwSendKey = VkKeyScan( tszSendKey[0] );
if(GetAsyncKeyState(VK_F9))
         {
         PostMessage(hGhostOnline, WM_KEYDOWN, VK_CONTROL && dwSendKey, NULL);
         }

_________________

Back to top
View user's profile Send private message AIM Address MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Jul 27, 2008 6:00 pm    Post subject: Reply with quote

mrkrishan wrote:
How about something like this:

Code:

DWORD dwSendKey = VkKeyScan( tszSendKey[0] );
if(GetAsyncKeyState(VK_F9))
         {
         PostMessage(hGhostOnline, WM_KEYDOWN, VK_CONTROL && dwSendKey, NULL);
         }


No.
VK_CONTROL && dwSendKey is a conditional and. It will only work in a conditional expression, not as a parameter.
I'm pretty sure if you want to send keys with the Ctrl button down you can set the high order word of dwSendKey to 2

_________________
Back to top
View user's profile Send private message
Aviram
Grandmaster Cheater
Reputation: 0

Joined: 30 Jun 2006
Posts: 633

PostPosted: Sun Jul 27, 2008 7:36 pm    Post subject: Reply with quote

|| Would be the solution I'm pretty sure.
Code:

DWORD dwSendKey = VkKeyScan( tszSendKey[0] );
if(GetAsyncKeyState(VK_F9))
         {
         PostMessage(hGhostOnline, WM_KEYDOWN, VK_CONTROL || dwSendKey, NULL);
         }
[/code]
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Jul 27, 2008 7:43 pm    Post subject: Reply with quote

Aviram wrote:
|| Would be the solution I'm pretty sure.
Code:

DWORD dwSendKey = VkKeyScan( tszSendKey[0] );
if(GetAsyncKeyState(VK_F9))
         {
         PostMessage(hGhostOnline, WM_KEYDOWN, VK_CONTROL || dwSendKey, NULL);
         }
[/code]


No.. Confused
|| is the conditional or
It cannot be used as a parameter either..

_________________
Back to top
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Sun Jul 27, 2008 7:49 pm    Post subject: Reply with quote

Im not so sure about this. Try this:

Code:
PostMessage(hGhostOnline, WM_KEYDOWN, VK_CONTROL, NULL);
PostMessage(hGhostOnline, WM_KEYDOWN, dwSendKey, NULL);

PostMessage(hGhostOnline, WM_KEYUP, dwSendKey, NULL);
PostMessage(hGhostOnline, WM_KEYUP, VK_CONTROL, NULL);
Back to top
View user's profile Send private message Send e-mail
Aviram
Grandmaster Cheater
Reputation: 0

Joined: 30 Jun 2006
Posts: 633

PostPosted: Sun Jul 27, 2008 10:30 pm    Post subject: Reply with quote

My friend told me that you can use that way:
Code:

         PostMessage(hGhostOnline, WM_KEYDOWN, (VK_CONTROL | dwSendKey, NULL);
Back to top
View user's profile Send private message
Hieroglyphics
I post too much
Reputation: 0

Joined: 06 Dec 2007
Posts: 2007
Location: Your bedroom

PostPosted: Sun Jul 27, 2008 11:54 pm    Post subject: Reply with quote

I need to make it so that they can input text, and I believe lurc over almost anybody :\
_________________

Back to top
View user's profile Send private message AIM Address MSN Messenger
slippppppppp
Grandmaster Cheater
Reputation: 0

Joined: 08 Aug 2006
Posts: 929

PostPosted: Mon Jul 28, 2008 12:25 am    Post subject: Re: [C++]How to make a configurable key to spam? Reply with quote

mrkrishan wrote:
How can I make it so that users can change the key that will be spammed in the bot/trainer I am making this is what I have I already have the part for the window and I am using this postmessage:

Code:
if(GetAsyncKeyState(VK_F9))
         {
         PostMessage(hGhostOnline, WM_KEYDOWN, 0x5A, NULL);
         }


I need to know how they can type in a key after pressing F9 and then it will spam that key instead of a set key.

BTW it is a console DLL



hmm. im not completely sure and im coding this off the top of my head, so just go ahead and try it :


Code:
for( int i = 30; i < 50 + 1; i++ )
     
      if( GetAsyncKeyState( i ) )
               {
      String plus = "0x" + i.ToStr();

      int vkcode = plus.ToInt();

      PostMessage(hGhostOnline, WM_KEYDOWN, MapVirtualkey(vkcode, 0), NULL);
                }



fyi, supports 0 - 9, A - Z (some letters, maybe 2 - 4 are not supported)
Back to top
View user's profile Send private message AIM Address MSN Messenger
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Mon Jul 28, 2008 2:13 am    Post subject: Reply with quote

This thread is really unclear. But anyways.
Make an edit control:
http://msdn.microsoft.com/en-us/library/bb775458(VS.85).aspx
Then, I think I'd grab the text from the control and do a loop that converts each character to a VKK and PostMessage's it.
http://msdn.microsoft.com/en-us/library/ms633520.aspx
http://msdn.microsoft.com/en-us/library/ms646329(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx

_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.
Back to top
View user's profile Send private message
Aviram
Grandmaster Cheater
Reputation: 0

Joined: 30 Jun 2006
Posts: 633

PostPosted: Mon Jul 28, 2008 4:01 am    Post subject: Reply with quote

Hmm you can get string length then do a loop to send every character the string have..
Uh I forgot the function to get string's amount of characters..
Hehe I wrote what ^^ wrote.. just in different words I didnt notice Razz
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Mon Jul 28, 2008 4:03 am    Post subject: Reply with quote

Create commands to set the hotkeys.

Ex: setkey HP A

You can use something to translate it to a virtual key. Then push where you stored the value for GetAsyncKeyState.

_________________
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Mon Jul 28, 2008 4:17 am    Post subject: Reply with quote

Bit offtopic, but I always thought Ghost Online used DInput?
Back to top
View user's profile Send private message MSN Messenger
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Mon Jul 28, 2008 4:18 am    Post subject: Reply with quote

noz3001 wrote:
Bit offtopic, but I always thought Ghost Online used DInput?
It does. =/ If you check the WNDPROC, you will see no cmps with WM_KEYDOWN, WM_CHAR or WM_UNICHAR.
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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