Solved

Keyboard Insert / Overwrite Mode

Posted on 2002-04-30
2
659 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
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

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.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

749 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