473,587 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ 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,co de, wparam, lparam);
if( wparam.ToInt32( ) == 98 || wparam.ToInt32( ) == 66 )
{
this.textBox1.T ext = "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 1863
I am crazy already.
"½£¾ªºè" <cr*********@et ang.com> дÈëÏûÏ¢ÐÂÎÅ:%2 *************** ***@TK2MSFTNGP1 0.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,co de, wparam, lparam);
if( wparam.ToInt32( ) == 98 || wparam.ToInt32( ) == 66 )
{
this.textBox1.T ext = "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
4809
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 Authentication set up and it worked just fine. Then I realized that I needed to have some pages unsecure. I then created 2 directories. One named Secure and...
1
3370
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 place(like taskbar),it cant work,why?help me. this is the hook: // HookDll.cpp : Defines the initialization routines for the DLL. // #include...
9
3949
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 will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine...
1
2916
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 implemented keydown event handler on my form control, but when some other control has focus, all keypress events are generated on that control. Q: how...
13
4295
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 that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I...
3
3473
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 directly to the second application in a browser, all of my events fire correctly. However, if I have the first application do a Response.Redirect to...
0
2142
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 is sent as an input to events like KeyDown, KeyUp and KeyPress. Wat do this events do. I dont find any definitions for these events. private int...
2
4672
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 paint message and injects the custom UI. From the reading I've done, it is possible to install a system hook with an unmanaged stub that passes...
1
7267
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 and Brand I need to make some changes on a a number of brands in a Category
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
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 we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.