Solved

How to catch Del  and Delete key press ?

Posted on 1997-08-28
12
1,160 Views
Last Modified: 2013-12-03
I have an editor from made from scrach, however, I never
get WM_KEYDOWN send to me, when Del or Delete key pressed.
I would like the use not only use backspace but also Del
and Delete key.

Any Solutions

Thank you very much
0
Comment
Question by:gaohong
[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
12 Comments
 
LVL 3

Expert Comment

by:Melange
ID: 1405029
Are you absolutely sure you're not getting a WM_KEYDOWN? According to the documentation you should get one with bit 24 in the flags turned on (for extended key). I believe it should be flagged as VK_DELETE character.
0
 
LVL 3

Author Comment

by:gaohong
ID: 1405030
I am sure I did not get WM_KEYDOWN message, when Del or Delete
key is pressed. Except those two keys, all the other key press
I got WM_KEYPRESS.

It is not something I missed WM_KEYDOWN, because the message callback is never entered when Del or Delete key pressed. However, I do notice an editor control did
response to the Del or Delete key, while a normal window does not, so it must be something tricky.

Sorry I have to refuse your answer.
0
 
LVL 4

Expert Comment

by:md041797
ID: 1405031
TranslateMessage changes these to WM_CHAR & WM_SYSCHAR messages.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 4

Accepted Solution

by:
md041797 earned 60 total points
ID: 1405032
TranslateMessage changes these to WM_CHAR & WM_SYSCHAR messages.
0
 
LVL 3

Author Comment

by:gaohong
ID: 1405033
Are you sure, md ?  Because, neither I get WM_CHAR message when
Del or Delete key pressed.  I will try WM_SYSCHAR. Could you little bit more clear

Thanks, md
0
 
LVL 3

Author Comment

by:gaohong
ID: 1405034
md, could not catch WM_SYSCHAR, WM_SYSKEYDOWN neither, when
Del or Delete key pressed. Any idea ?
0
 
LVL 4

Expert Comment

by:md041797
ID: 1405035
No, this is a new one one me.  Are you using a framework, or straight Windows?
0
 
LVL 3

Author Comment

by:gaohong
ID: 1405036
I am using TWindow of OWL. The problem is my window does not
get notified on either Del or Delete key presses. In any of following catcher

    EvSysKeyDown()
    EvSysChar()
    EvKeyDown()
    EvChar()
However, I do notice that my editor control, did catch them,
while the TEditFile window does not (one of editor I use in my
program).

Any idea ?
0
 
LVL 4

Expert Comment

by:davmarc
ID: 1405037
What about using a utility like Spy++ to figure out if the message gets to the window (and it's "eaten" somewhere in the code) or not?

Davide Marcato.
0
 
LVL 4

Expert Comment

by:md041797
ID: 1405038
This is sent to the Windows edit control directly through DispatchMessage.  The only way to get around this is to overload TApplication::ProcessMsg(MSG& msg).
0
 
LVL 23

Expert Comment

by:chensu
ID: 1405039
When the Delete key or the Del (.) key without NumLock is pressed, the WM_KEYDOWN message (VK_DELETE) is sent. It is not translated to WM_CHAR or WM_SYSCHAR message. When the Del (.) key with NumLock is pressed, the WM_KEYDOWN message (VK_DECIMAL) is sent and the WM_CHAR (VK_DELETE) is also sent. You should get the WM_KEYDOWN message each time a key is pressed. Check your message loop.
0
 
LVL 3

Author Comment

by:gaohong
ID: 1405040
Thanks for all your guys comments and answer. It seems that
Application's PressMsg() eaten up the Del and Delete key.
After change, It did response to the Delete key now.

Gaohong Xie
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ODBC Connection; Switch between 2 SQL Databases VBA 11 146
Which Microsoft MSDN Package Is The One I need? 3 51
Windows ICD FFU Issue 4 105
Why use this lambda? 12 94
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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