?
Solved

Remapping Keys

Posted on 2001-09-03
8
Medium Priority
?
448 Views
Last Modified: 2008-02-26
I want to build a program in C++ Builder (Win9X)
that will be able to remap keys systemwide.
For exemple, if I press F1 it will type "// my tag"
and things like that in any program.

Do you have any idea how that could be done?

I searched the net many hours without finding
any clues...

Samples would be welcome, even if not C++ Builder stuff

Thanks!!!

0
Comment
Question by:HellSlayer
[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
8 Comments
 
LVL 2

Expert Comment

by:LoungeLizard
ID: 6451943
Do you want the keys to be remapped only while you are busy with your app, or in general i.e. if you switched to MS Word for example, do you still want the F1 to do something other than it normally would?

In the first case it is easiest to simply use the OnKeyDown event and then examine the key that was pressed and do something about it.
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6452071
Are you talking about doing this in the editor or in a program?

If you're talking about the editor, you may be able to create a macro and assign it to a key.  I personally would choose something other than F1 because it is normally reserved for the HELP key.

If you're talking about a program, you can trap the F1 key and other key.

Are you coding for DOS or Windows?
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6452156
Use TActionList component, it can help you.
Other option: use mainform's Menu property. This produces a static menubar at the top of the screen and every item
of menu can react to some shortcut.

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 11

Accepted Solution

by:
vo1d earned 1200 total points
ID: 6452685
if u wanna remap keys systemwide, u will ve to use
SetWindowsHookEx and
LowLevelKeyboardProc() function.
for more details, take a look at the msdn of microsoft.
http://www.msdn.microsoft.com/library/
0
 

Author Comment

by:HellSlayer
ID: 6455159
I want to remap the keyboard systemwide
under Win9X

if I press a key I want it to do something
else than it would do normaly
0
 
LVL 3

Expert Comment

by:Diplomat
ID: 6455191
In order to do that you'll need to write a global dll hook that will capture windows messages related to the keyboard, then translate these keystrokes to whatever you want to do. And this will work in any Windows application running.

This is a rather complex project depending on your level of C++ programming. I myself had a similar project and it took me many months to complete. It's not as simple as just by showing some sample codes.

To summarize, you need to master at least the followings:
1. Understand how windows messages are processed.
2. Know how to write a global dll.

One place to start is to look for 'Hook' under VC++ Help, or at the MSDN Library. There you will also be able to access some sample codes provided by Microsoft.
0
 

Author Comment

by:HellSlayer
ID: 6455214
Perfect!!!

I searched everything but hook...   :)

Thank You!
0
 

Author Comment

by:HellSlayer
ID: 6455237
Months!!!!!
...
Well...
I'll do my best...
I hope it wont be that long...

0

Featured Post

Technology Partners: 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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

752 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