473,400 Members | 2,163 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,400 software developers and data experts.

hooking the keyboard from IE

Hi all,
I have developed a BHO that installs low level keybaord hooks and CBT
hooks globally whenever IE is opened.The keys that are pressed when IE
is active are to be captured.I am trying to check whether the IE is
active first, If it is i set a boolean flag.In the key hook proc ,if
the flag is set, the keys are sent for further processing.The keyboard
hooks is working fine(when checked separately), but the CBT hooks is
not working properly. The IE page is taking a long time to load and
after it loads, its not informing me abt whether the IE is active. The
only code returns is the Window creations.Nothing else is happening.
My hook proc is as follows:
public static int CbtHookProc(int nCode, IntPtr wParam,IntPtr lParam)
{
StringBuilder title = new StringBuilder();
string classname;
title.Capacity=10;
if(nCode==HCBT_ACTIVATE)
{
try{
GetClassName(wParam,title,10);
classname=title.ToString();
if(classname.StartsWith("IE"))
IE_Active=true; //an bool variable set to false initially
else
IE_Active=false;
}
catch(Exception e) {
MessageBox.Show(e.ToString());
}
}
return CallNextHookEx(CBTHook,nCode,wParam,lParam);
}
Win32 Import for GetClassName is as follows:
[DllImport("user32.dll")]
protected static extern int GetClassName(IntPtr hwnd,
StringBuilder lpClassName, int nMaxCount);

Is this correct?If so , y is this not working? wat am i missing in
this?.
thanks and regards,
Hema

Apr 10 '06 #1
0 1163

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

Similar topics

0
by: Tony Pirkle | last post by:
In a former query: Modeless Form Ignores Keystrokes ONLY when called from VB.Net, I explain that I have a VB6 form that's not getting it's keystrokes. The events are firing, but the controls...
1
by: Matthew Kelly | last post by:
I have pulled together a VB.net project that hooks the keyboard (Ref. Paul Kimmel's hooking program) and allow the user to send "mouse right clicks" via the SendInpuut function (mouse emulation...
1
by: Greg Merideth | last post by:
Is there a way via c# to hook a system tray application into the windows keyboard que globally so that when the application is running and you press, say, control-alt-shift-f11 the system tray app...
3
by: Rick Strahl [MVP] | last post by:
I'm working on an app that's using the WebBrowser control. I got the control working fine, hooking to the document object. But I've run into a major issue with hooking the Document events....
2
by: Fabiano | last post by:
Please, is there a way i can hook the keyboard? I would like to hook everykey. CTRL+ALT+DEL, CTRL+ESC, and all others. The user just press some keys, and none control keys, not only at my app...
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 -...
8
by: pigeonrandle | last post by:
Hi, Has anyone had any experience with hooking messages in other application windows (like SPY++). I want to listen for WM_MOVE messages, but can only seem to find examples of Keyboard and Mouse...
1
by: zanthor | last post by:
Ok... so call me crazy, but I have an idea and I'm looking for where to start... I want to write an application that catches keystrokes and then either redirects them to the in focus window or...
1
by: adam2009 | last post by:
Hey all, I try to find some code that will log to some txt file all the keystrokes in a smartphone. I have read many blogs about it, but I'm still confused. There are two blogs that i tried...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.