Changeset 10189 for trunk/src


Ignore:
Timestamp:
Jul 31, 2003, 2:25:57 PM (22 years ago)
Author:
sandervl
Message:

Convert WM_CHAR characters to UTF-16 for unicode windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/oslibmsgtranslate.cpp

    r10185 r10189  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.111 2003-07-28 11:27:46 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.112 2003-07-31 12:25:57 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    3737#include <winscan.h>
    3838#include <winkeyboard.h>
     39#include <winnls.h>
    3940#include "hook.h"
    4041#include "user32api.h"
     
    5657
    5758//******************************************************************************
     59//
     60// setThreadQueueExtraCharMessage: queues WM_CHAR message so it is retrieved
     61//                                 by GetMessage & PeekMessage
     62//
     63// NOTE: Automatically converts ascii character code to UTF-16 if the target
     64//       window is unicode.
     65//
    5866//******************************************************************************
    5967BOOL setThreadQueueExtraCharMessage(TEB* teb, MSG* pExtraMsg)
     
    6371    // there's still an already translated message to be processed
    6472    return FALSE;
     73
     74  //Unicode windows expect the character code in UTF-16
     75  if(IsWindowUnicode(pExtraMsg->hwnd))
     76  {
     77      CHAR  charA;
     78      WCHAR charW;
     79
     80      charA = pExtraMsg->wParam;
     81      MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);
     82      pExtraMsg->wParam= charW;
     83      dprintf(("setThreadQueueExtraCharMessage: Convert to Unicode src=%x res=%x", charA, charW ));
     84  }
     85
    6586  teb->o.odin.fTranslated = TRUE;
    6687  memcpy(&teb->o.odin.msgWCHAR, pExtraMsg, sizeof(MSG));
     
    11611182      // insert message into the queue
    11621183      setThreadQueueExtraCharMessage(teb, &extramsg);
     1184
    11631185      return TRUE;
    11641186    }
Note: See TracChangeset for help on using the changeset viewer.