473,473 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

After using HOOK to catch the KeyPress message,is it possible to modify the content of the message?

Give an example:When user pressed "B" or "b",HOOK get that message and let
TextBox1.text display "a".

The executing founction is as following:
****************************************
IntPtr MyHookProc(int code, IntPtr wparam, IntPtr lparam)
{
if( code < 0 ) return CallNextHookEx(_nextHookPtr,code, wparam, lparam);
if( wparam.ToInt32() == 98 || wparam.ToInt32() == 66 )
{
this.textBox1.Text = "a";
return (IntPtr) 1;
}
else
{
return IntPtr.Zero;
}
}
****************************************

But if I want to use hook to catch and change the KeyPress Message what was
just made by user,that solution does not work.

My Problem is that using hook to catch the message "B" or "b",and then
change it as "a".Please modify the above function directly,thank you.

That problem confused me quite along time,I am nearly crazy!


Nov 17 '05 #1
1 1850
I am crazy already.
"½£¾ªºè" <cr*********@etang.com> дÈëÏûÏ¢ÐÂÎÅ:%2******************@TK2MSFTNGP10.phx .gbl...
Give an example:When user pressed "B" or "b",HOOK get that message and let
TextBox1.text display "a".

The executing founction is as following:
****************************************
IntPtr MyHookProc(int code, IntPtr wparam, IntPtr lparam)
{
if( code < 0 ) return CallNextHookEx(_nextHookPtr,code, wparam, lparam);
if( wparam.ToInt32() == 98 || wparam.ToInt32() == 66 )
{
this.textBox1.Text = "a";
return (IntPtr) 1;
}
else
{
return IntPtr.Zero;
}
}
****************************************

But if I want to use hook to catch and change the KeyPress Message what
was
just made by user,that solution does not work.

My Problem is that using hook to catch the message "B" or "b",and then
change it as "a".Please modify the above function directly,thank you.

That problem confused me quite along time,I am nearly crazy!

Nov 17 '05 #2

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

Similar topics

6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
1
by: ayiiq180 | last post by:
my hook already in a dll and the handle is shared,but the hook cant work well,when i run the application,My mouse click the application's view,the hook work well,but when i click the other...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
1
by: ~dr-sci-fi | last post by:
hi all, problem: i have several controls on my form which can get focus, like buttons/combos. i have to catch keyboard events for special keys like Alt-F1 on my form, for that, i simply...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
3
by: michael_vanommeren | last post by:
I have two web applications that I am working with and I am trying to do a Response.Redirect from one to the other. They are setup as separate web applications on the same IIS server. If I go...
0
by: priya | last post by:
hello, I am new to the window hook development area. I found the following code in a link,i am not able to understand this. Please explain me wat this does. The code has the KeyEventArgs and this...
2
by: Lunchtimemama | last post by:
I am trying to modify another application's window (Google Talk) to insert some UI of my own. I think the best method would be to install a remote local hook in gtalk's thread that intercepts the...
1
by: gnawz | last post by:
Hi guys, I have a couple of php files that perform various tasks. I will use fields in my system and provide code as well I need help as follows: My database contains the fields Category...
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,...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.