1 registered members (SBGuy),
652
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
alternative to mickey.z
#464661
03/04/17 12:01
03/04/17 12:01
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Hello, Since mickey.z is broken with touchpad and touchscreen zooming (as in it continues to stay on the value), I would like to use an alternative. I found this https://msdn.microsoft.com/en-us/library/windows/desktop/ms645617(v=vs.85).aspx on msdn, but cannot get it working. Does anyone have a snippet for this or something similar? If this is not possible, than I have thought of maybe resetting mickey.z to 0 overtime, but it seems to be readonly.
|
|
|
Re: alternative to mickey.z
[Re: Reconnoiter]
#464667
03/04/17 15:13
03/04/17 15:13
|
Joined: Oct 2011
Posts: 1,082 Germany
Ch40zzC0d3r
Serious User
|
Serious User
Joined: Oct 2011
Posts: 1,082
Germany
|
typedef void *HHOOK;
typedef struct tagKBDLLHOOKSTRUCT {
DWORD vkCode;
DWORD scanCode;
DWORD flags;
DWORD time;
ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, FAR *LPKBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;
All you need is to open WinUser.h in Visual Studio and rip the structs if you cannot include them. Acknex has its own Windows.h, alot of windows standard includes are missing.
Last edited by Ch40zzC0d3r; 03/04/17 15:14.
|
|
|
Re: alternative to mickey.z
[Re: Ch40zzC0d3r]
#464678
03/05/17 12:51
03/05/17 12:51
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Okay thanks seems to work I get the message boxes etc. For others:
#define WH_KEYBOARD_LL 13
#define WH_MOUSE_LL 14
#define MB_ICONERROR 0x00000010L
typedef void *HHOOK;
typedef struct tagKBDLLHOOKSTRUCT {
DWORD vkCode;
DWORD scanCode;
DWORD flags;
DWORD time;
long dwExtraInfo;
// ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT; //, FAR *LPKBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;
KBDLLHOOKSTRUCT *pKbdStruct;
// Callback function (called when a key is pressed)
LRESULT __stdcall HookCallback(int nCode, WPARAM wParam, LPARAM lParam) {
if (nCode >= 0) {
// the action is valid: HC_ACTION.
if (wParam == WM_KEYDOWN) {
// lParam is the pointer to the struct containing the data needed, so cast and assign it to kdbStruct
pKbdStruct = (KBDLLHOOKSTRUCT*)lParam;
// kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
// a key (non-system) is pressed.
if (pKbdStruct.vkCode == VK_F1) {
// F1 is pressed!
MessageBox(NULL, "F1 is pressed!", "key pressed", MB_ICONINFORMATION);
}
}
}
// call the next hook in the hook chain. This is nessecary or your hook chain will break and the hook stops
return CallNextHookEx(_hook, nCode, wParam, lParam);
}
void SetHook() {
// Set the hook and set it to use the callback function above
// WH_KEYBOARD_LL means it will set a low level keyboard hook. More information about it at MSDN.
// The last 2 parameters are NULL, 0 because the callback function is in the same thread and window as the
// function that sets and releases the hook. If you create a hack you will not need the callback function
// in another place then your own code file anyway. Read more about it at MSDN.
if (!(_hook = SetWindowsHookEx(WH_KEYBOARD_LL, HookCallback, NULL, 0))) {
MessageBox(NULL, "Failed to install hook!", "Error", MB_ICONERROR);
}
}
void ReleaseHook() {
UnhookWindowsHookEx(_hook);
}
void init_startup () {
// Set the hook
SetHook();
on_close = ReleaseHook;
on_exit = ReleaseHook;
}
|
|
|
|