Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello!
How to use CTRL, Shift and Alt keys in c/c++ program

What I have tried:

I saw many codes from different websites but did not work. Please help me.
I'm using visual studio.
Thanks
Posted
Updated 29-May-18 3:13am
Comments
Richard MacCutchan 29-May-18 7:59am    
Without knowing what you are trying to do it is difficult to give any suggestions. You could try looking at Virtual-Key Codes (Windows)[^].
Usama Iftikhar Butt 29-May-18 8:33am    
I want to write a program that if i press (ctrl or shift or alt) + some key then some action will be perform.
So how can i do it
Richard MacCutchan 29-May-18 9:35am    
You do it by writing code. But without further details of what your problem is we cannot suggest anything more than "please read the documentation".
BillWoodruff 29-May-18 8:48am    
What language are you programming in ?
Usama Iftikhar Butt 29-May-18 9:26am    
C and C++

1 solution

At first you need to learn the function around the keyboard. Keyboard Input Reference is a good starting point.

Normally these keys are used to trigger commands. Like "copy" with "Ctrl+C". That is your task in your app to write such handler functions and connect them with the keys. Here is some article about the so called Hot keys. In RegisterHotKey site is some sample code how to use it in C++.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900