Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 03:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[New]C++ Code

Discussion on [New]C++ Code within the C/C++ forum part of the Coders Den category.

Closed Thread
 
Old   #1
 
LogLife's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 260
Received Thanks: 17
Arrow [New]C++ Code

Please some one advice to me if i need the code from c++ for check keyboard button presses, For the concept when player press "Enter" key three time per five sec then exit process.
Please make example code for me thank you for advice.
LogLife is offline  
Old 10/06/2012, 10:26   #2
 
BioNicX's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 981
Received Thanks: 296
its in the exe i believe. you need to edit the client side exe.

PS: why do you put "[NEW]" ? , the forum lets us know if the thread is new or not lol.
BioNicX is offline  
Old 10/06/2012, 13:17   #3
 
elite*gold: 0
Join Date: Sep 2012
Posts: 46
Received Thanks: 55
You should just use a low level keyboard hook. I'm not going to post any code for sake of nubcakes making keyloggers from it. Look more into SetWindowsHookEx() using WH_KEYBOARD_LL.
WarmongerR4 is offline  
Old 10/07/2012, 05:59   #4
 
freeskier4lif3's Avatar
 
elite*gold: 0
Join Date: Sep 2008
Posts: 231
Received Thanks: 151
Code:
// How long should we allow for the 3 presses?
double timeSpan = 5.0;  // let's go with 5 seconds for this example as you asked

int counter = 0;  // used to count number of times Enter is pressed

// VARIABLES FOR TIMING
LARGE_INTEGER frequency;
LARGE_INTEGER startTime, currentTime;
double elapsedTime = 0;
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&startTime);


// CHECK for KEY PRESS
if(GetAsyncKeyState(VK_RETURN))
{
  // Calculate the time from last press
  QueryPerformanceCounter(&currentTime);
  elapsedTime = (currentTime.QuadPart - startTime.QuadPart) * 1000.0 / frequency.QuadPart;

  // If we are within the set time
  if(elapsedTime < timeSpan)
  {
     counter++;
  }
  else
  {
    // Set a new start time
    QueryPerformanceCounter(&startTime);
    counter = 1;
  }

  //Are we at 3 or more clicks of enter?
  if(counter >= 3)
  {
     exit(-1);  // exit the game
  }
}
freeskier4lif3 is offline  
Thanks
1 User
Old 10/07/2012, 06:07   #5
 
LogLife's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 260
Received Thanks: 17
Code:
Compiling...
Entercount.cpp
C:\Users\Administrator\Desktop\Enter\Entercount.cpp(197) : error C2065: 'VK_ENTER' : undeclared identifier
C:\Users\Administrator\Desktop\Enter\Entercount.cpp(211) : error C2065: '$startTime' : undeclared identifier
Error executing cl.exe.

Entercount.dll - 2 error(s), 0 warning(s)
LogLife is offline  
Old 10/07/2012, 06:13   #6
 
freeskier4lif3's Avatar
 
elite*gold: 0
Join Date: Sep 2008
Posts: 231
Received Thanks: 151
couple typos... you should have been able to figure it out was just an example. edited it though.
freeskier4lif3 is offline  
Old 10/07/2012, 08:51   #7
 
kokamentos's Avatar
 
elite*gold: 0
Join Date: Jun 2012
Posts: 116
Received Thanks: 24
Quote:
Originally Posted by LogLife View Post
Code:
Compiling...
Entercount.cpp
C:\Users\Administrator\Desktop\Enter\Entercount.cpp(197) : error C2065: 'VK_ENTER' : undeclared identifier
C:\Users\Administrator\Desktop\Enter\Entercount.cpp(211) : error C2065: '$startTime' : undeclared identifier
Error executing cl.exe.

Entercount.dll - 2 error(s), 0 warning(s)
You need WinUser.h

#define VK_RETURN 0x0D
kokamentos is offline  
Closed Thread


Similar Threads Similar Threads
[GAMESCOM-SHOP] Vindictus Code, FireFall BETA Code, McGame.com Code, Victory Ukash
10/18/2012 - elite*gold Trading - 8 Replies
Hallo Leute hab ein paar Sachen auf der Gamescom gesammelt und übrig, diese möchte ich hier verkaufen. Ich akzeptiere nur Paypal, E*gold und Paysafecards! Hier ist eine Liste mit Bildern (natürlich sind die Codes zensiert :D): 1. Firefall Beta KEY Ihr macht den Preis! Bild 2. Vindictus Code 50 e*gold Bild
used king Rammus code OR katarina kitty cat code (KR) → used PAX sivir code (NA / EU)
08/23/2012 - League of Legends Trading - 2 Replies
Hello Korea is my server users. I NA / EU servers have already been used in the "Pax Sivir Code" wants As a reward, "king Rammus code OR Katarina kitty cat code" I will send you to gift. Have already used the code, Feel free to do the exchange! Please send mail [email protected]
used king Rammus code OR katarina kitty cat code (KR) → used PAX sivir code (NA / EU)
08/20/2012 - League of Legends Trading - 0 Replies
Hello Korea is my server users. I NA / EU servers have already been used in the "Pax Sivir Code" wants As a reward, "king Rammus code OR Katarina kitty cat code" I will send you to gift. Have already used the code, Feel free to do the exchange! Please send mail [email protected]



All times are GMT +1. The time now is 03:41.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.