Solved

Keyboard Insert / Overwrite Mode

Posted on 2002-04-30
2
661 Views
Last Modified: 2013-12-03
How can I programmatically detect whether the keyboard is in insert mode or in overwrite mode?

I know that one way of doing this is to have an ActiveX StatusBar control with a Panel with Style = sbrIns. The Panel is Enabled if the keyboard is in insert mode, but only if the StatusBar is Enabled and physically visible. I do not want a StatusBar on the Form. So I would like to know how to do this with the Win32 API.
0
Comment
Question by:SimonORorke
[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
2 Comments
 
LVL 3

Expert Comment

by:GGRUNDY
ID: 6982702
BOOL isInsert =  ::GetKeyState(VK_INSERT)&1;
0
 
LVL 5

Accepted Solution

by:
robpitt earned 200 total points
ID: 6984416
Insert/overwrite are application specific concepts, hence every app must keep track of this itself.

Whilst using GetKeyState(VK_INSERT)&1 might appear to work, this isn't advisable because this state toggles for all presses of Insert not just the ones you want to listen to.

A better solution is to have your editing window (where you type the text to) handle the WM_KEYDOWN message and toggle a variable.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…

734 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