Solved

Challenging question for any expert

Posted on 2003-11-04
11
176 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
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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month6 days, 19 hours left to enroll

623 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