Dark_Byte's Speedhack source code

Posts 76–86 of 86 · Page 6 of 6
Quote Originally Posted by Hell_Demon View Post
well, see for yourself why I use it:

Code:
#include <windows.h>
#include <iostream>
using namespace std;

int main()
{
	while(1)
	{
		if(GetAsyncKeyState(VK_NUMPAD0)&1)
		{
			cout<<"numpad 0 is pressed :)\n";
		}
		if(GetAsyncKeyState(VK_NUMPAD1))
		{
			cout<<"numpad 1 is pressed :)\n";
		}
		if(GetAsyncKeyState(VK_NUMPAD5))
		{
			break;
		}
		Sleep(1);
	}
	return 0;
}
press numpad 0 and 1 once and see the difference

numpad0 will output it once for a single press, unless you hold it down for a few seconds
numpad 1 spam the text.

Therefor I prefer using &1 for toggles since it doesnt get switched back over a million times
I will test that when I get time.... today's been hectic... :L
It's more eficient IMO. With GetAsyncKeystate you check if a key is down or up, then you execute a piece of code. With RegisterHotkey you set a system wide hotkey. Then whenever that key is pressed, it sends a WM_HOTKEY to the application specified in the hwnd param for further handling. Instead of looping forever like with GAK.
Quote Originally Posted by Micheltjuh View Post
It's more eficient IMO. With GetAsyncKeystate you check if a key is down or up, then you execute a piece of code. With RegisterHotkey you set a system wide hotkey. Then whenever that key is pressed, it sends a WM_HOTKEY to the application specified in the hwnd param for further handling. Instead of looping forever like with GAK.
Wow. that sounds pretty cool. Lol "GAK" anyway.... there's always about a hundred ways to go about any task. I will try both.
Event/Message-Based > Loop-Based
Quote Originally Posted by Micheltjuh View Post
It's more eficient IMO. With GetAsyncKeystate you check if a key is down or up, then you execute a piece of code. With RegisterHotkey you set a system wide hotkey. Then whenever that key is pressed, it sends a WM_HOTKEY to the application specified in the hwnd param for further handling. Instead of looping forever like with GAK.
Okies, thanks, i'll keep that in mind next time. It does sound a lot more efficient. By the way, do you know a good method to tell the computer that a certain key is being pressed? For example make the computer think that the 3 key is being pressed or something
Quote Originally Posted by zeco View Post
Okies, thanks, i'll keep that in mind next time. It does sound a lot more efficient. By the way, do you know a good method to tell the computer that a certain key is being pressed? For example make the computer think that the 3 key is being pressed or something
Code:
  // press DOWN "Alt-Tab"

  keybd_event(VK_MENU, 0, 0, 0);
  keybd_event(VK_TAB, 0, 0, 0);

  ::Sleep(1000);

  // stop pressing "Alt-Tab"

  keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
  keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0);
copied from CodeProject ^^
Quote Originally Posted by Hell_Demon View Post
Code:
  // press DOWN "Alt-Tab"

  keybd_event(VK_MENU, 0, 0, 0);
  keybd_event(VK_TAB, 0, 0, 0);

  ::Sleep(1000);

  // stop pressing "Alt-Tab"

  keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
  keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0);
copied from CodeProject ^^
Thank You.
Quote Originally Posted by zeco View Post
Okies, thanks, i'll keep that in mind next time. It does sound a lot more efficient. By the way, do you know a good method to tell the computer that a certain key is being pressed? For example make the computer think that the 3 key is being pressed or something
I prefer to use Postmessage over keybdevent.
Hey I wanted to figure out how to do that too sweet.
Quote Originally Posted by leecreations47 View Post
How do I compile it.
create a new text file on your desktop, rename it to compilemyhacks.txt
then you put everything we posted into the text file. now do start>run>telnet towel.blinkenlights.nl

watch the whole movie and then wonder why you are such a fish
Posts 76–86 of 86 · Page 6 of 6
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us