473,320 Members | 1,950 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,320 software developers and data experts.

WndProc not working as expected?

Hi

I have overriden WndProc to detect when the key is pressed. Because it
didnt work i inserted debug code to detect what messages pass through
the WndProc exactly.My application is minimized in taskbar and visible
via notifyicon. When I run the program :

protected override void WndProc(ref Message m)
{
System.Diagnostics.Debug.WriteLine(m.Msg);

base.WndProc(ref m);
}

I see :

36
129
131
1
12
70
36
131
71
3
14
13
5
128
128
14
13
14
13
124
125
124
125
70
131
71
70
71
14
13
24
49612

....and no more messages pass through WndProc. I need to catch windows
message when user presses Control twice. Why no more messages pass
through the WndProc and how to catch control presses twice?

Best Regards
PK
Aug 17 '08 #1
4 4105
The key down event would only occur if your window has focus, which it
doesn't. What you need is a global keyboard hook. I don't recall how to do
it, but two method names I do recall are SetWindowsHookEx and
CallNextHookEx.
Pete

Aug 17 '08 #2
On Aug 17, 3:14*pm, Piotrekk <Piotr.Kolodz...@gmail.comwrote:
Hi

I have overriden WndProc to detect when the key is pressed. Because it
didnt work i inserted debug code to detect what messages pass through
the WndProc exactly.My application is minimized in taskbar and visible
via notifyicon. When I run the program :

* * * * protected override void WndProc(ref Message m)
* * * * {
* * * * * * System.Diagnostics.Debug.WriteLine(m.Msg);

* * * * * * base.WndProc(ref m);
* * * * }

I see :

36
129
131
1
12
70
36
131
71
3
14
13
5
128
128
14
13
14
13
124
125
124
125
70
131
71
70
71
14
13
24
49612

...and no more messages pass through WndProc. I need to catch windows
message when user presses Control twice. Why no more messages pass
through the WndProc and how to catch control presses twice?

Best Regards
PK
Hello

You can do LowLevelHook in C#
It will tell you all the info about key up/down of mouse
Aug 18 '08 #3
I was thinking the same thing...here's a link.

http://blogs.msdn.com/toub/archive/2...03/589423.aspx

-Drew
Aug 19 '08 #4
On 19 Sie, 09:46, "DrewCE" <moc.sgodniahc@werd - backwardswrote:
I was thinking the same thing...here's a link.

http://blogs.msdn.com/toub/archive/2...03/589423.aspx

-Drew
Thank you
Aug 22 '08 #5

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

Similar topics

6
by: Beach Potato | last post by:
Hi: I've searched newsgroups and various archives, including MSDN & MFC sources, but at this point failed to locate an accurate and simple implementation of WndProc function for MSWindows window...
0
by: sshuangw | last post by:
Hello: I am encountering a very weird issue with MDI child, Overriden WndProc function and hidden form. Basically, the application has two forms, Form1(parent form), Form2(Child form),...
2
by: Ed Sutton | last post by:
How can a WndProc be created inside a component? Currently I have a WndProc in my frmMain. It looks for WM_DEVICECHANGE messages for connection and removal events for a USB/Serial device. My...
0
by: cyrille | last post by:
Hello from example from web i did a little code to avoiding columnHeader resize. this code seems to work well, but when I put a 'normal' ListView on the same Form than my overrided ListView it...
2
by: Benny Raymond | last post by:
Hi, I'm working on an app that has to inherit Form and override WndProc for several different reasons. Anyway it performs some actions on the window when WM_CREATE is called. The big problem...
2
by: dworthem | last post by:
if I have the compiler option /clr:oldSyntax in a Windows Forms application protected: void WndProc(System::Windows::Forms::Message* m) is called If I remove oldSyntax protected:
4
by: Rob | last post by:
I've constructed a user control inherited from ListView so I can handle and respond to scrolling events (to keep 2 listviews scrolling in sync). My user control includes an Overrides of WndProc...
0
by: makifsar | last post by:
I am using a comserver to communicate remote equipments. This server gives response via WndProc. First I call READ function to start communication and remote equipment gives response this via...
0
by: JDeats | last post by:
I need to be able to detect when the user clicks on the browser control area. The control offers no Mouse events whatsoever. I have tried to resort to override WndProc on the control, I have a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.