Solved

Challenging question for any expert

Posted on 2003-11-04
11
170 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
  • 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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9686603
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now