473,396 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Keyboard Hook Problem (seems verbally unsolvable)

Hello,
I have a very very big problem.
I try to set up a keyboard hook that captures keystrokes from every
application, but it seems not to work. I'm using Borland C++, but the
SetWindowsHookEx Function always returns NULL,

if you know an answer, pleaaaaase tell me, i would really appreciate that!
Code:
----------------------------------
#include <vcl.h>
#include <stdio.h>
#include <process.h>
#include <iostream.h>
#include "Unit1.h"

#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

static HHOOK hhook = 0, hhookMsg=0;
static HINSTANCE hInst;
LRESULT CALLBACK TastatureingabeErfolgt(HWND hDlg,int code, WPARAM wParam,
LPARAM lParam);

__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}

LRESULT CALLBACK TastatureingabeErfolgt(HWND hDlg,int code, WPARAM wParam,
LPARAM lParam)
{

return CallNextHookEx(hhook, code, wParam, lParam);
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{

hhook = SetWindowsHookEx(2, (HOOKPROC)TastatureingabeErfolgt, hInst,
(DWORD)NULL);
if(hhook==NULL)
MessageBox( NULL,
"Unable to install hook",
"Error!",
MB_OK);

}
Jul 22 '05 #1
1 2030
"Daniel von Fersen" <ca****@web.de> wrote in message
news:c7*************@news.t-online.com
Hello,
I have a very very big problem.
I try to set up a keyboard hook that captures keystrokes from every
application, but it seems not to work. I'm using Borland C++, but the
SetWindowsHookEx Function always returns NULL,

if you know an answer, pleaaaaase tell me, i would really appreciate
that!


This is off-topic here. Try a Windows newsgroup, e.g.,

microsoft.public.vc.language
or
comp.os.ms-windows.programmer.win32
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: daFritz | last post by:
Hi! I need to prevent Task-Switching in my App, so I tried to implement a low level keyboard hook in a extra class. But it seems that the Parameters are not passed correctly to my Hook function....
7
by: Don Riesbeck Jr. | last post by:
I'm working on an application (OEM) using C# that utilizes input from a keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard device, and input from it is sent to the system as if it...
2
by: Christoph Brüser | last post by:
Hi, in my application I want to react to certain keys when a context menu is showing. So I installed a keyboard hook, but now whenever a key is pressed when the menu is showing, the application...
0
by: William Hughes | last post by:
Hi, After doing a bit of googling, it seems everyone refers to the article "Managing Low-Level Keyboard Hooks in VB .NET" Written by Paul Kimmel -...
0
by: BobAchgill | last post by:
When I try to hook a non letter key like left arrow (37) all is OK. If (Hookstruct.vkCode = 37) Or (Hookstruct.vkCode = 83) And CBool(Hookstruct.flags) Then But, for example, the hook for the...
7
by: jpierson | last post by:
Hi, I am tryin to create a keyboard hook that sends the keystroke ctrl + pause/break. I haven't used keyboard hooks before so I'm not too sure how to use them public int MyKeyboardProc(int...
1
by: Louis Cypher | last post by:
I'm working on an application (OEM) using c# that uses input from a keyboard and a USB Barcode Scanner. I need to be able to identify keystrokes from the barcode scanner and remove them from the...
1
by: Louis Cypher | last post by:
I'm working on an application (OEM) using c# that uses input from a keyboard and a USB Barcode Scanner. I need to be able to identify keystrokes from the barcode scanner and remove them from the...
2
by: Justin | last post by:
So I have a keyboard hook that I have implemeted into my c# app. I need to not allow any hotkey actions to be performed when my app is opened. I can capture the key events and handle them if I want...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.