Hi,
this is still not correct. SendMessage is not a function but a macro. When the 
PROGRAM is compiled as unicode SendMessage is translated to SendMessageW and 
otherwise it is translated to SendMessageA.
Now regarding the convertion fron ansi to unicode or unicode to ansi, this is 
done when win32k calls user32 in the receiving process here: 
http://git.reactos.org/?p=reactos.git;a=blob;f=reactos/dll/win32/user32/windows/message.c;h=4e5e3430ced3df5242ace2f6c3725357ca01f024;hb=HEAD#l497
and 
http://git.reactos.org/?p=reactos.git;a=blob;f=reactos/dll/win32/user32/windows/message.c;h=4e5e3430ced3df5242ace2f6c3725357ca01f024;hb=HEAD#l828

ReactOS Development List <ros-dev@reactos.org> wrote on Thu, November 17th, 
2011, 3:09 AM:
> Thanks Timo for your explanation.
> So let me see if I understood correctly.
> When TC calls SendMessage(handle,CB_ADDSTRING,0,(LPARAM)ansitext); it could 
> be translated to SendMessageW or to SendMessageA accordingly to the window(*) 
> that receives the message:
> -If the receiving window is ANSI the SendMessage is translated to 
> SendMessageA and the Lparam is converted to ANSI(in this case there isn't 
> needed any translation as it was originally ANSI).
> -If the receiving window is UNICODE the SendMessage is translated to 
> SendMessageW and the Lparam is converted(**),in this case, from ANSI to 
> UNICODE, so SendMessageW is receiving an UNICODE string instead the original 
> ANSI one.
> Feel free to correct me if I am wrong.
> My doubts are:
> (*)When talking about the receiving "Window"...Which Window are we talking 
> about in this particular case?Isn't the SendMessage supposed to be sent to 
> the ComboBox window?
> (**)If I understood correctly, the LParam originally ANSI is translated to 
> UNICODE before being sent to the SendMessageW. Which function/macro does this 
> translation?Just curious...
> So the problem maybe is in the **p*rintf function that prints the line in the 
> Combobox?
> 
> Thanks again for your time
> VĂ­ctor
> 
> 
> 
> 
> 
> Date: Wed, 16 Nov 2011 21:14:07 +0100
> From: timo.kreu...@web.de
> To: ros-dev@reactos.org
> Subject: Re: [ros-dev] SendMessageW doubt/bug with ANSI LPARAM.
> 
> 
>   
> 
> 
>     
>   
>   
>     Am 16.11.2011 16:12, schrieb victor martinez:
>     
>       
>       
>         >The Total Commander comboboxes for the left and right drive list
> >are Unicode. However, Total Commander calls
> >SendMessage(handle,CB_ADDSTRING,0,(LPARAM)ansitext);
> >to add items as ANSI text. This seems to work, but it's adding some
> >extra text at the end.
> 
> If I understand correctly, Total Commander is calling SendMessage, which in
> this case is translated to SendMessageW (as the comboboxes are Unicode).
>       
>     
>     No, the fact that the combo boxes are unicode, doesn't mean TC is
>     calling SendMessageW, It could very well call SendMessageA and pass
>     an ansi string.
> 
>     If it passes an ANSI string to SendMessageW then it's doing it
>     wrong.
> 
>     The message is supposed to be translated accordingly when it's
>     passed to the recevier, based on whether the receiving window is
>     ANSI or unicode.
> 
>     
> 
>     The problem also doesn't seem to be ANSI vs unicode, but the "extra text 
> at the end".
> 
>       First thought: someone forgot that UNICODE_STRINGs are not
>       neccessarily 0 terminated.
> 
>       
> 
>       Timo
> 
>       
> 
>       
> 
>     
>   
> 
> 
> _______________________________________________
> Ros-dev mailing list
> Ros-dev@reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
> _______________________________________________
> Ros-dev mailing list
> Ros-dev@reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev

_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Reply via email to