Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Any Experts Like to Challange This Questions???

Any Experts Like to Challange This Questions???

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    percyvimal
    wrote on last edited by
    #1

    I have created a wh_getmessage hook and filtered all the keyboard messages going to the system wide application. NOw i have the msg structure with me i have to change the wm_char obtained from the msg structure to extended ascii character how to do this?????? Is there no experts in the world who like to give a try??? please

    D 1 Reply Last reply
    0
    • P percyvimal

      I have created a wh_getmessage hook and filtered all the keyboard messages going to the system wide application. NOw i have the msg structure with me i have to change the wm_char obtained from the msg structure to extended ascii character how to do this?????? Is there no experts in the world who like to give a try??? please

      D Offline
      D Offline
      Dave Bryant
      wrote on last edited by
      #2

      LRESULT CALLBACK MyGetMsgProc(int code, WPARAM wParam, LPARAM lParam) {   if ( code < 0 ) {     return ::CallNextHookEx( hHook, code, wParam, lParam );   }   MSG* pMsg = reinterpret_cast<MSG*>( lParam );   if ( WM_CHAR == pMsg->message ) {     TCHAR ch = static_cast<TCHAR>( pMsg->wParam );     // Do something with it   }   return ::CallNextHookEx( hHook, code, wParam, lParam ); } Dave http://www.cloudsofheaven.org

      P 1 Reply Last reply
      0
      • D Dave Bryant

        LRESULT CALLBACK MyGetMsgProc(int code, WPARAM wParam, LPARAM lParam) {   if ( code < 0 ) {     return ::CallNextHookEx( hHook, code, wParam, lParam );   }   MSG* pMsg = reinterpret_cast<MSG*>( lParam );   if ( WM_CHAR == pMsg->message ) {     TCHAR ch = static_cast<TCHAR>( pMsg->wParam );     // Do something with it   }   return ::CallNextHookEx( hHook, code, wParam, lParam ); } Dave http://www.cloudsofheaven.org

        P Offline
        P Offline
        percyvimal
        wrote on last edited by
        #3

        Thank you Mr. Dave for trying my question and i am confident that you may provide me the answer what i am looking for. I am just a begginer in Vc++ and so could you give some comments on the line of codings you have put for me. For i couldnt get the idea Like in pmsg i will get the character say Wm_char = A.Then what i need is to replace this A with € . Please give me some comments and illustrations. Still Thank you very much.

        D 1 Reply Last reply
        0
        • P percyvimal

          Thank you Mr. Dave for trying my question and i am confident that you may provide me the answer what i am looking for. I am just a begginer in Vc++ and so could you give some comments on the line of codings you have put for me. For i couldnt get the idea Like in pmsg i will get the character say Wm_char = A.Then what i need is to replace this A with € . Please give me some comments and illustrations. Still Thank you very much.

          D Offline
          D Offline
          Dave Bryant
          wrote on last edited by
          #4

          The first three lines of the function, handle the case where the code is less than zero. According to MSDN for the get message hook, in that case we must immediately call CallNextHookEx() without doing anything else. Then we retrieve the MSG structure (which defines a windows message). It is stored in the lParam passed to our callback function (again details from MSDN - look up SetWindowsHookEx() and follow the link for the get message hook). Next we check that it is the WM_CHAR message - everything else we are ignoring. Once we have the WM_CHAR message, we know that the character is stored in the wParam of the message (check MSDN for WM_CHAR), and so can retrieve it from there. If we wanted to modify the character, then we just set the value of pMsg->wParam at this point. e.g. ... if ( 'A' == ch ) {   // Modify the character   pMsg->wParam = 0x1234; // Some random unicode character } ... Dave http://www.cloudsofheaven.org

          P 1 Reply Last reply
          0
          • D Dave Bryant

            The first three lines of the function, handle the case where the code is less than zero. According to MSDN for the get message hook, in that case we must immediately call CallNextHookEx() without doing anything else. Then we retrieve the MSG structure (which defines a windows message). It is stored in the lParam passed to our callback function (again details from MSDN - look up SetWindowsHookEx() and follow the link for the get message hook). Next we check that it is the WM_CHAR message - everything else we are ignoring. Once we have the WM_CHAR message, we know that the character is stored in the wParam of the message (check MSDN for WM_CHAR), and so can retrieve it from there. If we wanted to modify the character, then we just set the value of pMsg->wParam at this point. e.g. ... if ( 'A' == ch ) {   // Modify the character   pMsg->wParam = 0x1234; // Some random unicode character } ... Dave http://www.cloudsofheaven.org

            P Offline
            P Offline
            percyvimal
            wrote on last edited by
            #5

            Thank you Mr.Dave. f ( 'A' == ch ) { // Modify the character pMsg->wParam = 0x1234; // Some random unicode character } Here you have given a unicode character but i am not using a unicode based application and the font i am going to use is true type which wont support unicode and so could you give me how to send an extended ascii character. in place of unicode. Thank you very much

            A 1 Reply Last reply
            0
            • P percyvimal

              Thank you Mr.Dave. f ( 'A' == ch ) { // Modify the character pMsg->wParam = 0x1234; // Some random unicode character } Here you have given a unicode character but i am not using a unicode based application and the font i am going to use is true type which wont support unicode and so could you give me how to send an extended ascii character. in place of unicode. Thank you very much

              A Offline
              A Offline
              Antti Keskinen
              wrote on last edited by
              #6

              The ASCII character set, both standard and extended, can be found from the MSDN Reference. Just surf to http://www.microsoft.com/msdn and use it's search function with keyword 'ASCII characters, table of codes'. This keyword will retrieve the ASCII character code table, at least on my latest MSDN Library release (April 2003). To replace the 'random Unicode character', you need to replace the hex value. For example, based on the ASCII code table, a hex value of 0x9B would result in the Euro sign, if my eyes didn't fail me :) The difference between standard ASCII and extended ASCII is that standard ASCII ranges from decimal values 0 to 127, and extended chart goes beyong 128, up until 255. The roots of this are in the original ASCII set. It was a 7-bit structure. Seven bits can represent 128 different states, hence the 'standard ASCII'. After the introduction of the new standard, a new ASCII structure was taken to use, consisting of 8-bits, hence, 256 different choices. As for the Unicode, it is just another expansion: it boasts more bits. I think the first 256 states of a Unicode system still offer the same characters as the extended ASCII does, but beyond that, they are completely set-dependant. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups