From ce7eccff48f0a1c155ce5f0482ef25196b71b625 Mon Sep 17 00:00:00 2001 From: chengyemao Date: Mon, 31 Jan 2005 04:08:32 +0000 Subject: Modified to handle a wide-character title string of a toplevel --- win/tkWinInt.h | 3 ++- win/tkWinWm.c | 12 ++++++++---- win/tkWinX.c | 4 +++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 02009ef..773807d 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinInt.h,v 1.22 2005/01/09 18:28:06 chengyemao Exp $ + * RCS: @(#) $Id: tkWinInt.h,v 1.23 2005/01/31 04:08:32 chengyemao Exp $ */ #ifndef _TKWININT @@ -200,6 +200,7 @@ typedef struct TkWinProcs { HINSTANCE hInstance, LPVOID lpParam); BOOL (WINAPI *insertMenu)(HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, LPCTSTR lpNewItem); + int (WINAPI *getWindowText)(HWND hWnd, LPCTSTR lpString, int nMaxCount); } TkWinProcs; EXTERN TkWinProcs *tkWinProcs; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index e680145..6551081 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWm.c,v 1.94 2005/01/16 00:23:13 chengyemao Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.95 2005/01/31 04:08:32 chengyemao Exp $ */ #include "tkWinInt.h" @@ -4958,9 +4958,13 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv) } if (objc == 3) { if(wrapper) { - char buf[256]; - GetWindowText(wrapper, buf, 256); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + char buf[512]; + Tcl_DString titleString; + int size = tkWinProcs->useWide? 256:512; + (*tkWinProcs->getWindowText)(wrapper, (LPCTSTR)buf, size); + Tcl_WinTCharToUtf(buf, -1, &titleString); + Tcl_SetResult(interp, Tcl_DStringValue(&titleString), TCL_VOLATILE); + Tcl_DStringFree(&titleString); } else { Tcl_SetResult(interp, (char *) ((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid), diff --git a/win/tkWinX.c b/win/tkWinX.c index 0b15aab..b8e8209 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinX.c,v 1.42 2005/01/16 00:23:15 chengyemao Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.43 2005/01/31 04:08:32 chengyemao Exp $ */ #include "tkWinInt.h" @@ -61,6 +61,7 @@ static TkWinProcs asciiProcs = { HINSTANCE hInstance, LPVOID lpParam)) CreateWindowExA, (BOOL (WINAPI *)(HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, LPCTSTR lpNewItem)) InsertMenuA, + (int (WINAPI *)(HWND hWnd, LPCTSTR lpString, int nMaxCount)) GetWindowTextA, }; static TkWinProcs unicodeProcs = { @@ -78,6 +79,7 @@ static TkWinProcs unicodeProcs = { HINSTANCE hInstance, LPVOID lpParam)) CreateWindowExW, (BOOL (WINAPI *)(HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, LPCTSTR lpNewItem)) InsertMenuW, + (int (WINAPI *)(HWND hWnd, LPCTSTR lpString, int nMaxCount)) GetWindowTextW, }; TkWinProcs *tkWinProcs; -- cgit v0.12