Any Experts Like to Challange This Questions???
-
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
-
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
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
-
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
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.
-
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.
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
-
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
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
-
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
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.