Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Catching ctrl-S

Posted on 1999-06-22
6
Medium Priority
?
784 Views
Last Modified: 2013-11-20
In, e.g., PreTranslateMessage() how do you catch combined key pressures, such as control-S ?
0
Comment
Question by:Claus
[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
6 Comments
 
LVL 4

Expert Comment

by:nil_dib
ID: 1307580
use the GetKeyState function:

e.g.
void CMyWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
        if (nChar == VK_S && GetKeyState(VK_CONTROL) < 0)
        {
              // ctrl + s is pressed
              // do something


0
 

Author Comment

by:Claus
ID: 1307581
It still doesn't work.  VK_S is unknown to the compiler.  Which header do I have to include to get it defined??
0
 
LVL 4

Expert Comment

by:nil_dib
ID: 1307582
ok,
sorry its
if (nChar == 'S' && GetKeyState(VK_CONTROL) < 0)
....
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Author Comment

by:Claus
ID: 1307583
It still doesn't work - I set a breakpoint in the function OnKeyDown.  It isn't even called.  What could prevent it from being called - the fact that I have PreTranslateMessage defined?
0
 

Accepted Solution

by:
vattal earned 50 total points
ID: 1307584
I have used this in pretranslate message . This works
if(pMsg->message == WM_KEYDOWN)
{            
      if  ((GetKeyState(17) & 0x8000) && ((pMsg->wParam >=0x73)))
      {
                  //Write U R code here
             }
}

Hope this helps
Adarsh S
0
 

Author Comment

by:Claus
ID: 1307585
What you posted didn't work but it helped me to find the right solution :

PreTranslateMessage(...)

if (GetKeyState(0x53) & 0x8000 && GetKeyState(VK_CONTROL) & 0x8000)
{
   code here ...
}


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

705 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