Solved

Challenging question for any expert

Posted on 2003-11-04
11
175 Views
Last Modified: 2010-05-03
Does anybody in the world have codings for this in either vb6 or vc++ so that it can be implemented in any windows OS on a system wide basis. IS this a very difficult process, for no experts in any sight have answered this question.?
               -----------------------------                        
                       Keyboard INPUT                        
               ------------------------------
                            | Ascii character(Say A)
                  |
      ---------------------------------------------        
                      Change toExteded Ascii (SayÜ)    
        ------------------------------------------------
                            |
                  |
      ---------------------------------------------        
                      Display in any active Application(System wide)    
        ------------------------------------------------                                              

 say if a user type A from the keyboard it should be converted to say € irrespective of whatever the application is running may be it is visual studio or word or notepad or photshop u name it.

 i need the codings of intercepting that message and load that message with extended ascii character(system wide and not for any single application)

thanks in advance
0
Comment
Question by:vimalpercy
[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
  • 2
  • 2
  • 2
  • +3
11 Comments
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9684484
this wont be too hard, you just need a program that watches keyboard event messages, gimme a few minutes and ill post some code for you.
0
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9684617
ok, a little of what i found was that you can use win API call
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
to tell if a key is being pressed such as...

Function GetPressedKey() As String
    For Cnt = 32 To 128
        If GetAsyncKeyState(Cnt) <> 0 Then
            GetPressedKey = ChrW$(Cnt)
            CurhWnd = GetActiveWindow
        End If
    Next Cnt
End Function

but this is a little weird, it only returns the absolute value of the key, like if i press a without pressing shift it returns that A was pressed, so youd have to detect if shift was down also.

you would then either send a keyboard event to the active program, like send backspace, then send the charactere you want it to be.  thats a bit junky and you need to use a timer to watch the GetKeyPressed function.

So i decided to look into hooks, you can hook your own threads keyboard calls but i couldnt get it to hook other threads messages so i figured that wouldnt be much of an option, unless someone else can determine what i was doing wrong for the hooking proc.

Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    If idHook < 0 Then
        KeyboardProc = CallNextHookEx(hHook, idHook, wParam, 0)
    Else
        frmServer.Label1 = GetPressedKey
        KeyboardProc = CallNextHookEx(hHook, idHook, wParam, 0)
    End If
End Function

that worked pretty well for the application that created the thread, but it wont work outside that.  one good thing is that the hooking doesnt require any timers.  So i hope this helps direct you a little better, sorry i couldnt nail it down.

0
 
LVL 5

Expert Comment

by:WorkingJourneyman
ID: 9686368
Adding to NBrownoh's excellent info...

It is possible to install a system-wide keyboard hook if the hooking code is packaged into a DLL. There is also a low-level keyboard hook (WH_KEYBOARD_LL) available which must be system-wide and seems to be the best match for your requirements. The documentation for these hooks should start you off on the right track.

MSDN links:
Hooks - http://msdn.microsoft.com/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Hooks.asp
SetWindowsHookEx - http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
KeyboardProc: http://msdn.microsoft.com/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Hooks/HookReference/HookFunctions/KeyboardProc.asp
LowLevelKeyboardProc: http://msdn.microsoft.com/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Hooks/HookReference/HookFunctions/LowLevelKeyboardProc.asp
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 26

Expert Comment

by:EDDYKT
ID: 9686603
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 9687091
"Subclass Keyboard and Mouse Events in Other Applications (Version 2.0)"
http://www.freevbcode.com/ShowCode.Asp?ID=1610
0
 

Author Comment

by:vimalpercy
ID: 9698988
Thank you experts  and all the link what you have given has effectively dont meet my requirement for i have implemented those ideas to get to certain point in my project. I have given where my problem is and i really looking for a really talented expert who can challenge this question and come up with some ideas or codings

Project Description

________________________

Keyboard
________________________
|
V
--------------------------------------------

Keyboard Hook (I have done this part)
--------------------------------------------
|
V
--------------------------------------------
Getting the Key Pressed or
combination of the key pressed(I have done this part)
---------------------------------------------
|
V
___________________________
problem i have is changing this
character into extended Ascii
character and sending to the
active application (system Wide)      ( <<<<<<<<I want Help from you in this area>>>>>>>>)
???????????????????????
???????????????????????
___________________________

Is any expert there who can help me on this???
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 9701473
'assume original hooked character is stored in strChar

'convert to Unicode
strChar = StrConv(strChar, vbUnicode)

'send new character
SendKeys strChar
0
 

Author Comment

by:vimalpercy
ID: 10163313
I have found the answer my self and so i like to post this question here
will i get all the 250 points though my available point is 60

Here the answers which i got is not the one i am looking for

so i like to close this question myself

thanks and regards
vimal
0
 

Accepted Solution

by:
amp072397 earned 0 total points
ID: 10528429
PAQed, with points refunded (250)

amp
Community Support Moderator amp~at~experts-exchange.com
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

729 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