Solved

Get WM_KEYDOWN from edit control

Posted on 1997-06-07
5
852 Views
Last Modified: 2013-12-03
Hi,
I have a smaller problem with Win32 API. I have created an edit control in my modeless application window (not a dialog window), and I would like to receive a message to the parent window when pressing Enter, arrow keys etc. Currently, I only receive messages when changing the contents of the edit control.

I have searched for a "parent notify" style, but there is no such thing. Please help if you can, thanks.
0
Comment
Question by:mnp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
jpk041897 earned 200 total points
ID: 1397921
WM_ParentNotify is not triggered buy KeyDown events, so you will have  to process the KeyDown inside your modless window's message loop and call SendMessage() to the parrent window whenever you recieve a key event.
0
 

Author Comment

by:mnp
ID: 1397922
My problem is to receive the WM_KEYDOWN message! I have ONE modeless window with a window procedure, including an edit control as a child window, nothing else. So how can I process the messages sent only to the edit control (like WM_KEYDOWN)?
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1397923
Well, In that case, CEdit is derived from CWND, so it will recieve a WM_KEYDOWN message, and by default behaviour, forward it to its parent window (at which point its getting lost).

What you can do is to subclass your CEdit control and process the WM_KEYDOWN there, leaving the rest of the controls behaviour unchanged.
0
 

Author Comment

by:mnp
ID: 1397924
I'm not using MFC, but native WinAPI. I've found a solution though (got the idea from another question on ee). I just changed the window procedure for the "EDIT" class to one of my own, and redirected all messages to the default procedure. It works just fine!
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1397925
Good to hear it! :-)

Thats exactly what goes on internaly in MFC when you subclass CEdit..
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Studio Exe Issue, 12 40
GUI: DIalog Stacking and Popping in MS C++ 4 94
Is AWS.RDS considered a part of "Big Data"? 4 154
Best book to learn C++ 4 94
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question