Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Challenging question for any expert

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
vimalpercy
Asked:
vimalpercy
  • 2
  • 2
  • 2
  • +3
1 Solution
 
NBrownohCommented:
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
 
NBrownohCommented:
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
 
WorkingJourneymanCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
AzraSoundCommented:
"Subclass Keyboard and Mouse Events in Other Applications (Version 2.0)"
http://www.freevbcode.com/ShowCode.Asp?ID=1610
0
 
vimalpercyAuthor Commented:
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
 
AzraSoundCommented:
'assume original hooked character is stored in strChar

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

'send new character
SendKeys strChar
0
 
vimalpercyAuthor Commented:
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
 
amp072397Commented:
PAQed, with points refunded (250)

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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now