Handle SetWindowText() across Unicode/Ansi conversions

svn path=/trunk/; revision=4730
This commit is contained in:
Gé van Geldorp 2003-05-19 20:11:17 +00:00
parent c1cf7ec993
commit ecd7b2f8f3
3 changed files with 61 additions and 10 deletions

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.45 2003/05/19 18:36:43 gvg Exp $
/* $Id: defwnd.c,v 1.46 2003/05/19 20:11:17 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -1477,6 +1477,12 @@ DefWindowProcA(HWND hWnd,
strlen((PSTR)lParam) * sizeof(CHAR));
strcpy(WindowText, (PSTR)lParam);
SetPropA(hWnd, WindowTextAtom, WindowText);
if (0 != (GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION))
{
DefWndPaintNC(hWnd, (HRGN) 1);
}
Result = (LPARAM) TRUE;
break;
}
case WM_NCDESTROY:
@ -1579,9 +1585,13 @@ DefWindowProcW(HWND hWnd,
wcslen((PWSTR)lParam) * sizeof(WCHAR));
wcscpy(WindowText, (PWSTR)lParam);
SetPropW(hWnd, WindowTextAtom, WindowText);
if (0 != (GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION))
{
DefWndPaintNC(hWnd, (HRGN) 1);
}
Result = (LPARAM) TRUE;
break;
}
//FIXME: return correct code
return TRUE;
case WM_NCDESTROY:
{

View file

@ -1,4 +1,4 @@
/* $Id: message.c,v 1.14 2003/05/12 19:30:00 jfilby Exp $
/* $Id: message.c,v 1.15 2003/05/19 20:11:17 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -93,6 +93,13 @@ User32FreeAsciiConvertedMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
RtlFreeHeap(RtlGetProcessHeap(), 0, TempString);
break;
}
case WM_SETTEXT:
{
ANSI_STRING AnsiString;
RtlInitAnsiString(&AnsiString, (PSTR) lParam);
RtlFreeAnsiString(&AnsiString);
break;
}
case WM_NCCREATE:
{
CREATESTRUCTA* Cs;
@ -133,6 +140,19 @@ User32ConvertToAsciiMessage(UINT* Msg, WPARAM* wParam, LPARAM* lParam)
(*lParam) = (LPARAM)CsA;
break;
}
case WM_SETTEXT:
{
ANSI_STRING AnsiString;
UNICODE_STRING UnicodeString;
RtlInitUnicodeString(&UnicodeString, (PWSTR) *lParam);
if (NT_SUCCESS(RtlUnicodeStringToAnsiString(&AnsiString,
&UnicodeString,
TRUE)))
{
*lParam = (LPARAM) AnsiString.Buffer;
}
break;
}
}
return;
}
@ -203,8 +223,22 @@ MsgiAnsiToUnicodeMessage(LPMSG UnicodeMsg, LPMSG AnsiMsg)
UnicodeMsg->wParam = UnicodeMsg->wParam / 2;
break;
}
case WM_SETTEXT:
{
ANSI_STRING AnsiString;
UNICODE_STRING UnicodeString;
RtlInitAnsiString(&AnsiString, (PSTR) AnsiMsg->lParam);
if (! NT_SUCCESS(RtlAnsiStringToUnicodeString(&UnicodeString,
&AnsiString,
TRUE)))
{
return FALSE;
}
UnicodeMsg->lParam = (LPARAM) UnicodeString.Buffer;
break;
}
}
return(TRUE);
return TRUE;
}
BOOL
@ -230,6 +264,13 @@ MsgiAnsiToUnicodeReply(LPMSG UnicodeMsg, LPMSG AnsiMsg, LRESULT Result)
RtlFreeHeap(RtlGetProcessHeap(), 0, TempString);
break;
}
case WM_SETTEXT:
{
UNICODE_STRING UnicodeString;
RtlInitUnicodeString(&UnicodeString, (PCWSTR) UnicodeMsg->lParam);
RtlFreeUnicodeString(&UnicodeString);
break;
}
}
return(TRUE);
}

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.32 2003/05/18 07:51:41 gvg Exp $
/* $Id: window.c,v 1.33 2003/05/19 20:11:17 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -897,7 +897,9 @@ IsWindow(HWND hWnd)
WINBOOL STDCALL
IsWindowUnicode(HWND hWnd)
{
#ifdef TODO
UNIMPLEMENTED;
#endif
return FALSE;
}
@ -1021,16 +1023,14 @@ WINBOOL STDCALL
SetWindowTextA(HWND hWnd,
LPCSTR lpString)
{
UNIMPLEMENTED;
return FALSE;
return SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString);
}
WINBOOL STDCALL
SetWindowTextW(HWND hWnd,
LPCWSTR lpString)
{
UNIMPLEMENTED;
return FALSE;
return SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString);
}
WINBOOL STDCALL