473,625 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Diagnost ics.Debug.Write Line(m.Msg);

base.WndProc(re f 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 4153
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 SetWindowsHookE x and
CallNextHookEx.
Pete

Aug 17 '08 #2
On Aug 17, 3:14*pm, Piotrekk <Piotr.Kolodz.. .@gmail.comwrot e:
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.Diagnost ics.Debug.Write Line(m.Msg);

* * * * * * base.WndProc(re f 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
6630
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 objects. Something like: class BaseWindow { virtual LRESULT WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
0
2494
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), Form2's WndProc method is overriden, if the message is CLOSE message, just hide the form. I first initialize and show the child form, then close it by clicking the Close(X) button, the overriden WndProc method gets invoked, and the form is hidden. Then
2
21456
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 frmMain uses a component to communicate with a USB/Serial device. I would prefer that this component handle the WM_DEVICECHANGE messages internally and only fires events to my frmMain when my USB device connects or disconnects. In case anyone...
0
4492
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 seems to stop working. if I'm resizing 'normal' ListView ColumnHeaders, then I can resizing ColumnHeaders of my overrided ListView. If I don't resizing 'normal' ListView ColumnHeaders, then resizing of my overrided ListView ColumnHeaders is...
2
1576
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 right now is that the designer view goes nutz when it opens up because the program doesn't load the configuration correctly. Is there anything i can do to keep that block of code from running when in designer view? Perhaps something like this: #if...
2
2457
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
12007
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 (I've attached the code at the end of this mail). Is it possible to 'disable' this override until I need it - it's just when I populate the ListViews this sub is called repeatadly. What I'd like to do is populate the listviews and then 'enable'...
0
1326
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 WndProc. Mw request is, I want to sleep READ thead and after taking right message from WndProc, wake up this thead return this value to main thead. I am trying some methods using delagate but I can not achive it. My Program like this Public Void...
0
1476
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 break point set where indicated in the code below which never gets called. Any alternative methods or suggestions on why this isn't working? protected override void WndProc(ref System.Windows.Forms.Message m) {
0
8692
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8497
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
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
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1499
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.