While Loop Taking Alot of CPU Usage

Posted by CuriousUser on Stack Overflow See other posts from Stack Overflow or by CuriousUser
Published on 2009-09-16T04:10:22Z Indexed on 2010/04/19 7:23 UTC
Read the original article Hit count: 274

Filed under:
|

I am creating a keystroke logger for my personal interest, as well wanting to know how to capture and use them as functions (like key shortcuts).

I got the code to learn how keylogger and GetAsyncKeyState() work: http://www.rohitab.com/discuss/index.php?showtopic=9931

I got it to run under Code::Blocks, but the weirdest things is that when I check my task manager, my CPU Usage rises to 100%. When I close the program, it goes back down, and goes back up to 100 when I turn it back on.

I presume it's because of the infinite while loop, constantly checking for inputs, but I wanna know if there's anyway to decrease the CPU usage, without losing function.

P.S How would I make a key shortcut? Like press (Ctrl + E) to make the program exit?

© Stack Overflow or respective owner

Related posts about c++

Related posts about keylogger

  • Visible Keylogger (ie not evil)

    as seen on Super User - Search for 'Super User'
    I want keylogging software on my laptop for lifelogging purposes. But the software I can find is targeted towards stealth activity. Can anyone recommend a keylogging software targeted towards personal backup. Ideal Functionality Runs publicly (like in the task bar). Easy to turn off (via keyboard… >>> More

  • Crypto-Analysis of keylogger logs and config file. Possible?

    as seen on Super User - Search for 'Super User'
    Is there anyway Encryption on an unidentified file can be broken(file in question: config file and log files from ardamax keylogger). These files date back all the way to 2008. I searched everywhere, nothing on slashdot, nothing on google. Ardamax Keyviewer? Should I just write to Ardamax? I am at… >>> More

  • Are there keylogger viruses that affect Ubuntu?

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I just within the last few hours had my Amazon and Gmail accounts hijacked. Purchases were made through my Amazon account that I didn't authorize...in fact, I wasn't even in my room. According to Gmail, the IP address of when I got hijacked was where I live. Enough rambling, here's my question:… >>> More

  • Keyloggers and Virtualization

    as seen on Super User - Search for 'Super User'
    Whilst pondering about security, and setting up different VM for certain online activities deemed more risky or requiring extra security (banking, or visiting untrusted websites, etc), I came to think about how such a setup (different VMs for different uses) would defend me against a keylogger. So… >>> More

  • Malicious Software

    as seen on Super User - Search for 'Super User'
    I had a program created for me recently and didn't really think about it being executable posing a threat since I pretty much trust the source but not completely. I then thought about the fact that a keylogger, or any kind of spyware or malicious software could've been possibly binded to it. This… >>> More