[python-win32] Confused about PreTranslateMessage

niki niki at vintech.bg
Fri Mar 6 09:35:35 CET 2009


Greg Ewing wrote:
> I'm having trouble understanding how PreTranslateMessage
> is supposed to work.
> 
> According to M$:
> 
>   Return value: Nonzero if the message was translated
>   and should not be dispatched; 0 if the message was
>   not translated and should be dispatched.
> 
> and according to the pywin32 docs:
> 
>   The result should be a tuple of the same format as
>   the msg param, in which case the MSG structure will
>   be updated and TRUE returned from the C++ function.
> 
> If all of that is true, I don't see what the purpose
> is of updating the MSG, since it's just going to be
> ignored when TRUE is returned.
> 
> But in any case it doesn't seem to be working -- the
> original message gets dispatched anyway, regardless
> of what I return from my PreTranslateMessage method.
> 
> So I'm totally confused at this point. Should I be
> able to prevent the original message from being
> dispatched, and if so, how do I go about it?
> 

IIRC one have to patch PreTranslateMessage code in order to get all 
variants to work. I can dig my old patches if required, but using MFC is 
  PITA anyway. Venster project has some good substitute ctypes code.

Niki


More information about the python-win32 mailing list