C++ Tapper

Posts 1–7 of 7 · Page 1 of 1
C++ Tapper
I made a C++ Tapper, I fixed the errors seemingly, but it doesn't do anything. If anyone could tell me what's wrong, that would be awesome.

I don't fully understand the LRESULT CALLBACK, I tried using a void function but it gave me converting errors so I was told I had to use LRESULT CALLBACK.

Code:
// tapper2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <time.h>
using namespace std;

LRESULT CALLBACK ConnectInternet(int nCode, WPARAM wParam, LPARAM lParam)
{
	system("NET START DHCP");
	cout << "Connecting." << endl;
	return 0;
}

LRESULT CALLBACK DCInternet(int nCode, WPARAM wParam, LPARAM lParam)
{
	system("NET STOP DHCP");
	cout << "Disconnecting." << endl;
	return 0;
}

int main()
{
	cout << "Welcome to Eddie's Tapper Program." << endl;
	cout << "Press Page Down to disconnect your internet and Page Up to connect it." << endl;
	for(;;)
	{
		SetWindowsHookEx(VK_PRIOR, ConnectInternet, GetModuleHandle(NULL), NULL);
	    SetWindowsHookEx(VK_NEXT, DCInternet, GetModuleHandle(NULL), NULL);
		Sleep(200); // Keep from overloading the processor.
	}
	return 0;
}
That's everything, don't steal my code though.

Just to all the script kiddies / copy and pasters out there, if I see this recompiled and produced everywhere, I'm gonna bust some fucking heads.
I just got an idea. we could make a tapper dll that we could injetc into combat arms and we just have to give it hotkeys
Quote Originally Posted by stevethehacker View Post
I just got an idea. we could make a tapper dll that we could injetc into combat arms and we just have to give it hotkeys
That's what I was working on. I'm making a console application so I can learn how to do hooks first, though.
I have the main hotkeys etc. working, the only problem I'm having is hooks.
a) You're calling SetWindowsHookEx in a loop. You need to do this only once outside the loop

b) You're passing Virtual Key Values to SetWindowsHookEx which is incorrect. You need to specify the type of hook (WH_KEYBOARD or WH_KEYBOARD_LL) and then parse the message you received to see if it is the key you want and then process that. (so you'll have only 1 callback function that parses what key was pressed and does whatever it needs to when it sees pgup/pgdown)

c) You'll want to call GetNextHookEx in your callback

d) Also when you exit your program be sure to call UnhookWindowsHookEx

Your other option would be to use a global hotkey with the RegisterHotKey function


of course if you fix it using any of these above suggestions you're "technically" using my 'code' since I told you what to do so you can't use it.... rofl j/k
Quote Originally Posted by B1ackAnge1 View Post
a) You're calling SetWindowsHookEx in a loop. You need to do this only once outside the loop

b) You're passing Virtual Key Values to SetWindowsHookEx which is incorrect. You need to specify the type of hook (WH_KEYBOARD or WH_KEYBOARD_LL) and then parse the message you received to see if it is the key you want and then process that. (so you'll have only 1 callback function that parses what key was pressed and does whatever it needs to when it sees pgup/pgdown)

c) You'll want to call GetNextHookEx in your callback

d) Also when you exit your program be sure to call UnhookWindowsHookEx

Your other option would be to use a global hotkey with the RegisterHotKey function


of course if you fix it using any of these above suggestions you're "technically" using my 'code' since I told you what to do so you can't use it.... rofl j/k
isnt SetWindowsHookEx detected as a virus. Some Anti Virus detect it as virus or i guess keylogger uses this function.
I'm more doing this for learning purposes, I don't plan on actually releasing anything until I get better at C++.

This would be a lot easier to pull off in VB6. I'm running into a shit load of errors.
Quote Originally Posted by That0n3Guy View Post
I'm more doing this for learning purposes, I don't plan on actually releasing anything until I get better at C++.

This would be a lot easier to pull off in VB6. I'm running into a shit load of errors.
Not to bust balls here but if you're just learning C++ or whatever, I am too, and it's hard. But from the results I see here and hear from other people, the trouble of going through all of it is well worth it. The easier isn't necessarily the better. Every book i've read has stated somewhere, "In C++ you can achieve results that are difficult to achieve in another language or impossible in another." or something along those lines. So yeah. Don't give up! I just take short breaks occasionally so I can let it all sink in.

And I don't know why i'm trying to tell you something, because you're already MUCH farther than me. I've not even gotten into console applications yet. And you've already programmed a friggin tapper! (Almost) But yeah.
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?