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.kreuzer@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