CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: Intercepting wm_char

  1. #1
    Join Date
    Oct 2003
    Location
    srilanka
    Posts
    88

    Intercepting wm_char

    i have to hook the keyboard and get keydown event and which key is pressed and then
    intercept the wm_char message which is generated for that keydown event and change that particular character and translate that to my own character and that character is an extended ascii character.
    Sir i have designed a font file and i included lot of new characters in the font file to accomadate more characters which Tamil language have.I can easily manage to access the 52 characeters in A_Z and a-z using normal keyboard ,but i have included 200 characters .I am not using unicode for i am not using opentype font but only true type font.the remaining characters are in other ascii range .Is it possibe to display them by changing the wm_char message.?
    if so how is it possible ?
    Do anybody know how to hook the message and intercept keyboard messages and change the character system wide.

    thanks in advance

  2. #2
    Join Date
    Nov 2002
    Location
    Lahore, Pakistan
    Posts
    52

    Re: Intercepting wm_char

    Originally posted by rvvimal
    i have to hook the keyboard and get keydown event and which key is pressed and then
    intercept the wm_char message which is generated for that keydown event and change that particular character and translate that to my own character and that character is an extended ascii character.
    Sir i have designed a font file and i included lot of new characters in the font file to accomadate more characters which Tamil language have.I can easily manage to access the 52 characeters in A_Z and a-z using normal keyboard ,but i have included 200 characters .I am not using unicode for i am not using opentype font but only true type font.the remaining characters are in other ascii range .Is it possibe to display them by changing the wm_char message.?
    if so how is it possible ?
    Do anybody know how to hook the message and intercept keyboard messages and change the character system wide.

    thanks in advance



    If you have all of the characters in a TTF file all u have to do is to SendMessage to that window with WM_CHAR message and number in your font file

    for example if you want to display 65 in your edit box send message like this

    m_editBox.SendMessage ( WM_CHAR, 65, 0 )

    you can replace 65 with what ever u want

  3. #3
    Join Date
    Oct 2003
    Location
    srilanka
    Posts
    88

    intercepting wm_char messages

    Thank you very much Mr.Shehzad_Salim

    The problem i have is i have to intercept all key events and track the wm_char message generated by that keydown event and send to any application which is having the current focus.
    For example if a user is typing in word and if he selects my font then he should be able to type in that or if he chose notepad or photoshop then he should be able to type in that application and using my application they should be able to get access to those extended ascii characters.

  4. #4
    Join Date
    Nov 2002
    Location
    Lahore, Pakistan
    Posts
    52
    Get the handle of current window


    then call IsKindOf and dertermine either that window is of type editbox etc... if so send WM_CHAR message

  5. #5
    Join Date
    Oct 2003
    Location
    srilanka
    Posts
    88

    intercept wm_char messages

    Thank you very much Mr.Shehzad_Salim
    i managed to get the handle of the active window ie formost window using the api GetForegroundWindow
    i read about IsKindOf function and it is really beyond my level to understand what has given in that msdn article.
    Sir i have got the keystrokes and i managed to combine the keystrokes also and i want to do is to intercept the message that window is generating for that keydown event and from that message take wm_char parameter and change that parameter.

    Sir i need your help in
    1. How to intercept that message before it goes to the respective application.
    2.how to obtain wm_char message from that intercepted message.
    3.How to change ?
    4 how to send to the active application?

    Thanks in advance
    rv vimal

  6. #6
    Join Date
    Nov 2002
    Location
    Lahore, Pakistan
    Posts
    52
    If u want to get the notification about the notification about any message dispachted to a particular window there u can PreTranslateMessage but this is about if your r owing the process.

    But if not then u r not owing the process
    then u have to call ::TranslateMessage and don't call the api which will send the message to the current window i.e. :ispatchMessage

    you can look more closely about these api's in MSDN

    TranslateMessage
    DispatchMessage
    GetMessage

    and more importantly MSG structure which has very important information

  7. #7
    Join Date
    Oct 2003
    Location
    srilanka
    Posts
    88

    intercepting wm_char message

    Thank you very much Mr.Shehzad_Salim
    Sir i need little detailed answers and how to implement practically with if possible with an example.

    1. How to intercept that message before it goes to the respective application or any application , from my application.
    2.how to obtain wm_char message from that intercepted message.
    4.How to prevent that message from going to its defalut application.
    3.How to change the wm_char message and load my own exteded ascii wm_char message ?
    4 how to send to the active application or to the application that message to be send ?

    Sir I want answers in the form of 1,2,3 & 4 for each question and if possible elobrate answers for me to apply that codings in my aplication.

    Thanks in advance
    rv vimal

  8. #8
    Join Date
    Nov 2002
    Location
    Lahore, Pakistan
    Posts
    52

    Re: intercepting wm_char message

    Originally posted by rvvimal
    Thank you very much Mr.Shehzad_Salim
    Sir i need little detailed answers and how to implement practically with if possible with an example.

    1. How to intercept that message before it goes to the respective application or any application , from my application.
    2.how to obtain wm_char message from that intercepted message.
    4.How to prevent that message from going to its defalut application.
    3.How to change the wm_char message and load my own exteded ascii wm_char message ?
    4 how to send to the active application or to the application that message to be send ?

    Sir I want answers in the form of 1,2,3 & 4 for each question and if possible elobrate answers for me to apply that codings in my aplication.

    Thanks in advance
    rv vimal

    Check the below link
    http://www.codeproject.com/system/hooksys.asp

    This would help you in intercept messages.......

  9. #9
    Join Date
    Oct 2003
    Location
    srilanka
    Posts
    88
    Thank you very much Mr.Shehzad_Salim

    The Sight you have mentioned is really useful but the ideas are very tough for a student like me to understand.But it is a shame on my part.

    Sir all i need is 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 some guidance from you how to implement this idea on a system wide basis may be if possible with some eloborate codings .
    Thanks in advance.

  10. #10
    Join Date
    Oct 2003
    Location
    srilanka
    Posts
    88
    Thank you very much Mr.Shehzad_Salim
    I found out that the best possible method to implement to get a keyboard message is setting up a Wh_getmessage hook

    to obtain system wide hook.

    using the pointer of the msg structure i can get the wm_char message.

    Sir tell me how to change that character message to extended ascii character
    Thanks and if u give your email id then i can mail to you in detail.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)