Solved

Keyboard Insert / Overwrite Mode

Posted on 2002-04-30
2
653 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
Comment Utility
BOOL isInsert =  ::GetKeyState(VK_INSERT)&1;
0
 
LVL 5

Accepted Solution

by:
robpitt earned 200 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now