summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2019-09-24 12:34:42 (GMT)
committerKevin Walzer <kw@codebykevin.com>2019-09-24 12:34:42 (GMT)
commitb5942485c76bfda6223b6c9eaec84813e6d2e3f9 (patch)
tree3b88d072917b6b748246d0c472190c140026d5e9 /win
parentcd20edbb665c16909bbd2a4e4f883d84c05892da (diff)
parent93a3e63b7e9a22f94f1101b7ba32ac79738e5b65 (diff)
downloadtk-b5942485c76bfda6223b6c9eaec84813e6d2e3f9.zip
tk-b5942485c76bfda6223b6c9eaec84813e6d2e3f9.tar.gz
tk-b5942485c76bfda6223b6c9eaec84813e6d2e3f9.tar.bz2
Merge 8.6
Diffstat (limited to 'win')
-rw-r--r--win/tkWinButton.c8
-rw-r--r--win/tkWinClipboard.c54
-rw-r--r--win/tkWinColor.c2
-rw-r--r--win/tkWinDialog.c76
-rw-r--r--win/tkWinDraw.c2
-rw-r--r--win/tkWinEmbed.c10
-rw-r--r--win/tkWinFont.c46
-rw-r--r--win/tkWinInit.c2
-rw-r--r--win/tkWinInt.h18
-rw-r--r--win/tkWinKey.c14
-rw-r--r--win/tkWinMenu.c60
-rw-r--r--win/tkWinScrlbr.c8
-rw-r--r--win/tkWinSend.c6
-rw-r--r--win/tkWinSendCom.c6
-rw-r--r--win/tkWinTest.c24
-rw-r--r--win/tkWinWm.c96
-rw-r--r--win/tkWinX.c22
-rw-r--r--win/ttkWinMonitor.c6
-rw-r--r--win/ttkWinXPTheme.c4
19 files changed, 211 insertions, 253 deletions
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index fc5d9e2..f7b8ed2 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -242,7 +242,7 @@ CreateProc(
{
Window window;
HWND parent;
- const WCHAR *class;
+ LPCWSTR class;
WinButton *butPtr = (WinButton *)instanceData;
parent = Tk_GetHWND(parentWin);
@@ -258,7 +258,7 @@ CreateProc(
parent, NULL, Tk_GetHINSTANCE(), NULL);
SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
- butPtr->oldProc = (WNDPROC)SetWindowLongPtr(butPtr->hwnd, GWLP_WNDPROC,
+ butPtr->oldProc = (WNDPROC)SetWindowLongPtrW(butPtr->hwnd, GWLP_WNDPROC,
(LONG_PTR) ButtonProc);
window = Tk_AttachHWND(tkwin, butPtr->hwnd);
@@ -289,7 +289,7 @@ TkpDestroyButton(
HWND hwnd = winButPtr->hwnd;
if (hwnd) {
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc);
+ SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc);
}
}
@@ -1306,7 +1306,7 @@ ButtonProc(
return result;
}
}
- return DefWindowProc(hwnd, message, wParam, lParam);
+ return DefWindowProcW(hwnd, message, wParam, lParam);
}
/*
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index 418b872..8886f2a 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -79,7 +79,7 @@ TkSelGetSelection(
goto error;
}
data = GlobalLock(handle);
- Tcl_WinTCharToUtf((WCHAR *)data, -1, &ds);
+ Tcl_WinTCharToUtf((LPCTSTR)data, -1, &ds);
GlobalUnlock(handle);
} else if (IsClipboardFormatAvailable(CF_TEXT)) {
/*
@@ -157,7 +157,7 @@ TkSelGetSelection(
Tcl_DStringAppend(&ds, "\n", 1);
}
len = wcslen(fname);
- Tcl_WinTCharToUtf(fname, len * sizeof(WCHAR), &dsTmp);
+ Tcl_WinTCharToUtf((LPCTSTR)fname, len * sizeof(WCHAR), &dsTmp);
Tcl_DStringAppend(&ds, Tcl_DStringValue(&dsTmp),
Tcl_DStringLength(&dsTmp));
Tcl_DStringFree(&dsTmp);
@@ -327,43 +327,21 @@ TkWinClipboardRender(
}
*buffer = '\0';
- /*
- * Depending on the platform, turn the data into Unicode or the system
- * encoding before placing it on the clipboard.
- */
-
-#ifdef UNICODE
- Tcl_DStringInit(&ds);
- Tcl_WinUtfToTChar(rawText, -1, &ds);
- ckfree(rawText);
- handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
- (unsigned) Tcl_DStringLength(&ds) + 2);
- if (!handle) {
- Tcl_DStringFree(&ds);
- return;
- }
- buffer = GlobalLock(handle);
- memcpy(buffer, Tcl_DStringValue(&ds),
- (unsigned) Tcl_DStringLength(&ds) + 2);
- GlobalUnlock(handle);
+ Tcl_DStringInit(&ds);
+ Tcl_WinUtfToTChar(rawText, -1, &ds);
+ ckfree(rawText);
+ handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
+ Tcl_DStringLength(&ds) + 2);
+ if (!handle) {
Tcl_DStringFree(&ds);
- SetClipboardData(CF_UNICODETEXT, handle);
-#else
- Tcl_UtfToExternalDString(NULL, rawText, -1, &ds);
- ckfree(rawText);
- handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
- (unsigned) Tcl_DStringLength(&ds) + 1);
- if (!handle) {
- Tcl_DStringFree(&ds);
- return;
- }
- buffer = GlobalLock(handle);
- memcpy(buffer, Tcl_DStringValue(&ds),
- (unsigned) Tcl_DStringLength(&ds) + 1);
- GlobalUnlock(handle);
- Tcl_DStringFree(&ds);
- SetClipboardData(CF_TEXT, handle);
-#endif
+ return;
+ }
+ buffer = GlobalLock(handle);
+ memcpy(buffer, Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds) + 2);
+ GlobalUnlock(handle);
+ Tcl_DStringFree(&ds);
+ SetClipboardData(CF_UNICODETEXT, handle);
}
/*
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index ba9815c..fa3f233 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -347,7 +347,7 @@ XAllocColor(
color->blue = closeEntry.peBlue * 257;
entry = closeEntry;
if (index >= cmap->size) {
- OutputDebugStringA("XAllocColor: Colormap is bigger than we thought");
+ OutputDebugStringW(L"XAllocColor: Colormap is bigger than we thought");
}
} else {
cmap->size++;
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index afee8f2..27137e7 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -40,13 +40,9 @@
#define BIF_NEWDIALOGSTYLE 0x0040
#endif
-#ifndef BFFM_VALIDATEFAILED
-#ifdef UNICODE
-#define BFFM_VALIDATEFAILED 4
-#else
-#define BFFM_VALIDATEFAILED 3
-#endif
-#endif /* BFFM_VALIDATEFAILED */
+#ifndef BFFM_VALIDATEFAILEDW
+#define BFFM_VALIDATEFAILEDW 4
+#endif /* BFFM_VALIDATEFAILEDW */
typedef struct {
int debugFlag; /* Flags whether we should output debugging
@@ -120,11 +116,11 @@ static const struct {int type; int btnIds[3];} allowedTypes[] = {
*/
#define TkWinGetHInstance(from) \
- ((HINSTANCE) GetWindowLongPtr((from), GWLP_HINSTANCE))
+ ((HINSTANCE) GetWindowLongPtrW((from), GWLP_HINSTANCE))
#define TkWinGetUserData(from) \
- GetWindowLongPtr((from), GWLP_USERDATA)
+ GetWindowLongPtrW((from), GWLP_USERDATA)
#define TkWinSetUserData(to,what) \
- SetWindowLongPtr((to), GWLP_USERDATA, (LPARAM)(what))
+ SetWindowLongPtrW((to), GWLP_USERDATA, (LPARAM)(what))
/*
* The value of TK_MULTI_MAX_PATH dictates how many files can be retrieved
@@ -696,7 +692,7 @@ EatSpuriousMessageBugFix(void)
DWORD nTime = GetTickCount() + 250;
while (GetTickCount() < nTime) {
- PeekMessage(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE);
+ PeekMessageW(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE);
}
}
@@ -926,7 +922,7 @@ ColorDlgHookProc(
if ((title != NULL) && (title[0] != '\0')) {
Tcl_DString ds;
- SetWindowTextW(hDlg, Tcl_WinUtfToTChar(title,-1,&ds));
+ SetWindowTextW(hDlg, (LPCWSTR)Tcl_WinUtfToTChar(title,-1,&ds));
Tcl_DStringFree(&ds);
}
if (tsdPtr->debugFlag) {
@@ -1409,7 +1405,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
normPath = Tcl_FSGetNormalizedPath(interp, iniDirPath);
/* XXX - Note on failures do not raise error, simply ignore ini dir */
if (normPath) {
- const WCHAR *nativePath;
+ LPCWSTR nativePath;
Tcl_IncrRefCount(normPath);
nativePath = Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/
if (nativePath) {
@@ -1515,7 +1511,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
Tcl_DString ftds;
Tcl_Obj *ftobj;
- Tcl_WinTCharToUtf(filterPtr[ftix-1].pszName, -1, &ftds);
+ Tcl_WinTCharToUtf((LPCTSTR)filterPtr[ftix-1].pszName, -1, &ftds);
ftobj = Tcl_NewStringObj(Tcl_DStringValue(&ftds),
Tcl_DStringLength(&ftds));
Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
@@ -1954,8 +1950,8 @@ OFNHookProc(
buffer = ofnData->dynFileBuffer;
hdlg = GetParent(hdlg);
- selsize = (int) SendMessage(hdlg, CDM_GETSPEC, 0, 0);
- dirsize = (int) SendMessage(hdlg, CDM_GETFOLDERPATH, 0, 0);
+ selsize = (int) SendMessageW(hdlg, CDM_GETSPEC, 0, 0);
+ dirsize = (int) SendMessageW(hdlg, CDM_GETFOLDERPATH, 0, 0);
buffersize = (selsize + dirsize + 1);
/*
@@ -1970,10 +1966,10 @@ OFNHookProc(
ofnData->dynFileBuffer = buffer;
}
- SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, (LPARAM) buffer);
+ SendMessageW(hdlg, CDM_GETFOLDERPATH, dirsize, (LPARAM) buffer);
buffer += dirsize;
- SendMessage(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer);
+ SendMessageW(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer);
/*
* If there are multiple files, delete the quotes and change
@@ -2012,7 +2008,7 @@ OFNHookProc(
Tcl_GetPathType(Tcl_DStringValue(&tmpfile))) {
/* re-get the full path to the start of the buffer */
buffer = (WCHAR *) ofnData->dynFileBuffer;
- SendMessage(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer);
+ SendMessageW(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer);
} else {
*(buffer-1) = '\\';
}
@@ -2463,7 +2459,7 @@ Tk_ChooseDirectoryObjCmd(
utfDir = Tcl_DStringValue(&ofnOpts.utfDirString);
if (utfDir[0] != '\0') {
- const WCHAR *uniStr;
+ LPCWSTR uniStr;
Tcl_WinUtfToTChar(Tcl_DStringValue(&ofnOpts.utfDirString), -1,
&tempString);
@@ -2497,8 +2493,8 @@ Tk_ChooseDirectoryObjCmd(
bInfo.lParam = (LPARAM) &cdCBData;
if (ofnOpts.titleObj != NULL) {
- Tcl_WinUtfToTChar(Tcl_GetString(ofnOpts.titleObj), -1, &titleString);
- bInfo.lpszTitle = (LPWSTR) Tcl_DStringValue(&titleString);
+ bInfo.lpszTitle = (LPCWSTR)Tcl_WinUtfToTChar(
+ Tcl_GetString(ofnOpts.titleObj), -1, &titleString);
} else {
bInfo.lpszTitle = L"Please choose a directory, then select OK.";
}
@@ -2631,7 +2627,7 @@ ChooseDirectoryValidateProc(
}
chooseDirSharedData->retDir[0] = '\0';
switch (message) {
- case BFFM_VALIDATEFAILED:
+ case BFFM_VALIDATEFAILEDW:
/*
* First save and check to see if it is a valid path name, if so then
* make that path the one shown in the window. Otherwise, it failed
@@ -2641,7 +2637,7 @@ ChooseDirectoryValidateProc(
* like ~ are converted correctly.
*/
- Tcl_WinTCharToUtf((WCHAR *) lParam, -1, &initDirString);
+ Tcl_WinTCharToUtf((LPCTSTR) lParam, -1, &initDirString);
if (Tcl_TranslateFileName(chooseDirSharedData->interp,
Tcl_DStringValue(&initDirString), &tempString) == NULL) {
/*
@@ -2703,12 +2699,12 @@ ChooseDirectoryValidateProc(
*/
if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) {
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM) selDir);
+ SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir);
// enable the OK button
- SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
+ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
} else {
// disable the OK button
- SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0);
+ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0);
}
UpdateWindow(hwnd);
return 1;
@@ -2725,7 +2721,7 @@ ChooseDirectoryValidateProc(
if (*initDir == '\\') {
/*
- * BFFM_SETSELECTION only understands UNC paths as pidls, so
+ * BFFM_SETSELECTIONW only understands UNC paths as pidls, so
* convert path to pidl using IShellFolder interface.
*/
@@ -2741,7 +2737,7 @@ ChooseDirectoryValidateProc(
psfFolder, hwnd, NULL, (WCHAR *)
initDir, &ulCount,&pidlMain,&ulAttr))
&& (pidlMain != NULL)) {
- SendMessage(hwnd, BFFM_SETSELECTION, FALSE,
+ SendMessageW(hwnd, BFFM_SETSELECTIONW, FALSE,
(LPARAM) pidlMain);
pMalloc->lpVtbl->Free(pMalloc, pidlMain);
}
@@ -2750,9 +2746,9 @@ ChooseDirectoryValidateProc(
pMalloc->lpVtbl->Release(pMalloc);
}
} else {
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM) initDir);
+ SendMessageW(hwnd, BFFM_SETSELECTIONW, TRUE, (LPARAM) initDir);
}
- SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
+ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
break;
}
@@ -2802,7 +2798,7 @@ Tk_MessageBoxObjCmd(
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DString titleBuf, tmpBuf;
- const WCHAR *titlePtr, *tmpPtr;
+ LPCWSTR titlePtr, tmpPtr;
const char *src;
defaultBtn = -1;
@@ -2930,13 +2926,13 @@ Tk_MessageBoxObjCmd(
tsdPtr->hSmallIcon = TkWinGetIcon(parent, ICON_SMALL);
tsdPtr->hBigIcon = TkWinGetIcon(parent, ICON_BIG);
- tsdPtr->hMsgBoxHook = SetWindowsHookEx(WH_CBT, MsgBoxCBTProc, NULL,
+ tsdPtr->hMsgBoxHook = SetWindowsHookExW(WH_CBT, MsgBoxCBTProc, NULL,
GetCurrentThreadId());
src = Tcl_GetString(tmpObj);
- tmpPtr = Tcl_WinUtfToTChar(src, tmpObj->length, &tmpBuf);
+ tmpPtr = (LPCWSTR)Tcl_WinUtfToTChar(src, tmpObj->length, &tmpBuf);
if (titleObj != NULL) {
src = Tcl_GetString(titleObj);
- titlePtr = Tcl_WinUtfToTChar(src, titleObj->length, &titleBuf);
+ titlePtr = (LPCWSTR)Tcl_WinUtfToTChar(src, titleObj->length, &titleBuf);
} else {
titlePtr = L"";
Tcl_DStringInit(&titleBuf);
@@ -2984,9 +2980,9 @@ MsgBoxCBTProc(
if (WC_DIALOG == lpcbtcreate->lpcs->lpszClass) {
HWND hwnd = (HWND) wParam;
- SendMessage(hwnd, WM_SETICON, ICON_SMALL,
+ SendMessageW(hwnd, WM_SETICON, ICON_SMALL,
(LPARAM) tsdPtr->hSmallIcon);
- SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) tsdPtr->hBigIcon);
+ SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) tsdPtr->hBigIcon);
}
}
@@ -3033,7 +3029,7 @@ ConvertExternalFilename(
{
char *p;
- Tcl_WinTCharToUtf(filename, -1, dsPtr);
+ Tcl_WinTCharToUtf((LPCTSTR)filename, -1, dsPtr);
for (p = Tcl_DStringValue(dsPtr); *p != '\0'; p++) {
/*
* Change the pathname to the Tcl "normalized" pathname, where back
@@ -3070,7 +3066,7 @@ GetFontObj(
int pt = 0;
resObj = Tcl_NewListObj(0, NULL);
- Tcl_WinTCharToUtf(plf->lfFaceName, -1, &ds);
+ Tcl_WinTCharToUtf((LPCTSTR)plf->lfFaceName, -1, &ds);
Tcl_ListObjAppendElement(NULL, resObj,
Tcl_NewStringObj(Tcl_DStringValue(&ds), -1));
Tcl_DStringFree(&ds);
@@ -3194,7 +3190,7 @@ HookProc(
LOGFONTW lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0}};
HDC hdc = GetDC(hwndDlg);
- SendMessage(hwndDlg, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM) &lf);
+ SendMessageW(hwndDlg, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM) &lf);
if (phd && phd->cmdObj) {
ApplyLogfont(phd->interp, phd->cmdObj, hdc, &lf);
}
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 4341424..042d1b1 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -1448,7 +1448,7 @@ TkWinFillRect(
rect.bottom = y + height;
oldColor = SetBkColor(dc, (COLORREF)pixel);
SetBkMode(dc, OPAQUE);
- ExtTextOut(dc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
+ ExtTextOutW(dc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
SetBkColor(dc, oldColor);
}
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index ec2a2c3..1c6ba6c 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -160,7 +160,7 @@ void Tk_MapEmbeddedWindow(
{
if(!(winPtr->flags & TK_ALREADY_DEAD)) {
HWND hwnd = (HWND)winPtr->privatePtr;
- int state = SendMessage(hwnd, TK_STATE, -1, -1) - 1;
+ int state = SendMessageW(hwnd, TK_STATE, -1, -1) - 1;
if (state < 0 || state > 3) {
state = NormalState;
@@ -283,9 +283,9 @@ TkpUseWindow(
return TCL_ERROR;
}
- id = SendMessage(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0);
+ id = SendMessageW(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0);
if (id == PTR2INT(hwnd)) {
- if (!SendMessage(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) {
+ if (!SendMessageW(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"The container is already in use", -1));
Tcl_SetErrorCode(interp, "TK", "EMBED", "IN_USE", NULL);
@@ -1018,7 +1018,7 @@ TkpClaimFocus(
* it. */
{
HWND hwnd = GetParent(Tk_GetHWND(topLevelPtr->window));
- SendMessage(hwnd, TK_CLAIMFOCUS, (WPARAM) force, 0);
+ SendMessageW(hwnd, TK_CLAIMFOCUS, (WPARAM) force, 0);
}
/*
@@ -1096,7 +1096,7 @@ EmbedWindowDeleted(
break;
}
if (containerPtr->parentPtr == winPtr) {
- SendMessage(containerPtr->embeddedHWnd, WM_CLOSE, 0, 0);
+ SendMessageW(containerPtr->embeddedHWnd, WM_CLOSE, 0, 0);
containerPtr->parentPtr = NULL;
containerPtr->embeddedPtr = NULL;
break;
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 85a0131..321ecc4 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -406,7 +406,7 @@ TkWinSetupSystemFonts(
ZeroMemory(&ncMetrics, sizeof(ncMetrics));
ncMetrics.cbSize = sizeof(ncMetrics);
- if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
+ if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
sizeof(ncMetrics), &ncMetrics, 0)) {
CreateNamedSystemLogFont(interp, tkwin, "TkDefaultFont",
&ncMetrics.lfMessageFont);
@@ -425,7 +425,7 @@ TkWinSetupSystemFonts(
}
iconMetrics.cbSize = sizeof(iconMetrics);
- if (SystemParametersInfo(SPI_GETICONMETRICS, sizeof(iconMetrics),
+ if (SystemParametersInfoW(SPI_GETICONMETRICS, sizeof(iconMetrics),
&iconMetrics, 0)) {
CreateNamedSystemLogFont(interp, tkwin, "TkIconFont",
&iconMetrics.lfFont);
@@ -660,7 +660,7 @@ WinFontFamilyEnumProc(
Tcl_Obj *resultObj = (Tcl_Obj *) lParam;
Tcl_DString faceString;
- Tcl_WinTCharToUtf(lfPtr->elfLogFont.lfFaceName, -1, &faceString);
+ Tcl_WinTCharToUtf((LPCTSTR)lfPtr->elfLogFont.lfFaceName, -1, &faceString);
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
Tcl_DStringValue(&faceString), Tcl_DStringLength(&faceString)));
Tcl_DStringFree(&faceString);
@@ -743,14 +743,14 @@ TkpGetFontAttrsForChar(
* character */
FontFamily *familyPtr = thisSubFontPtr->familyPtr;
HFONT oldfont; /* Saved font from the device context */
- TEXTMETRIC tm; /* Font metrics of the selected subfont */
+ TEXTMETRICW tm; /* Font metrics of the selected subfont */
/*
* Get the font attributes.
*/
oldfont = SelectObject(hdc, thisSubFontPtr->hFont0);
- GetTextMetrics(hdc, &tm);
+ GetTextMetricsW(hdc, &tm);
SelectObject(hdc, oldfont);
ReleaseDC(fontPtr->hwnd, hdc);
faPtr->family = familyPtr->faceName;
@@ -1101,7 +1101,7 @@ Tk_DrawChars(
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRIC tm;
+ TEXTMETRICW tm;
SIZE size;
if (twdPtr->type != TWD_BITMAP) {
@@ -1128,7 +1128,7 @@ Tk_DrawChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
- GetTextMetrics(dcMem, &tm);
+ GetTextMetricsW(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1167,7 +1167,7 @@ Tk_DrawChars(
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRIC tm;
+ TEXTMETRICW tm;
SIZE size;
dcMem = CreateCompatibleDC(dc);
@@ -1182,7 +1182,7 @@ Tk_DrawChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
- GetTextMetrics(dcMem, &tm);
+ GetTextMetricsW(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1249,7 +1249,7 @@ TkDrawAngledChars(
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRIC tm;
+ TEXTMETRICW tm;
SIZE size;
if (twdPtr->type != TWD_BITMAP) {
@@ -1276,7 +1276,7 @@ TkDrawAngledChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
- GetTextMetrics(dcMem, &tm);
+ GetTextMetricsW(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1315,7 +1315,7 @@ TkDrawAngledChars(
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRIC tm;
+ TEXTMETRICW tm;
SIZE size;
dcMem = CreateCompatibleDC(dc);
@@ -1330,7 +1330,7 @@ TkDrawAngledChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
- GetTextMetrics(dcMem, &tm);
+ GetTextMetricsW(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1437,11 +1437,11 @@ MultiFontTextOut(
Tcl_DString runString;
const char *p, *end, *next;
SubFont *lastSubFontPtr, *thisSubFontPtr;
- TEXTMETRIC tm;
+ TEXTMETRICW tm;
lastSubFontPtr = &fontPtr->subFontArray[0];
oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
- GetTextMetrics(hdc, &tm);
+ GetTextMetricsW(hdc, &tm);
end = source + numBytes;
for (p = source; p < end; ) {
@@ -1473,7 +1473,7 @@ MultiFontTextOut(
lastSubFontPtr = thisSubFontPtr;
source = p;
SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
- GetTextMetrics(hdc, &tm);
+ GetTextMetricsW(hdc, &tm);
}
p = next;
}
@@ -1543,7 +1543,7 @@ InitFont(
HFONT hFont, /* Windows token for font. */
int overstrike, /* The overstrike attribute of logfont used to
* allocate this font. For some reason, the
- * TEXTMETRICs may contain incorrect info in
+ * TEXTMETRICWs may contain incorrect info in
* the tmStruckOut field. */
WinFont *fontPtr) /* Filled with information constructed from
* the above arguments. */
@@ -1551,7 +1551,7 @@ InitFont(
HDC hdc;
HWND hwnd;
HFONT oldFont;
- TEXTMETRIC tm;
+ TEXTMETRICW tm;
Window window;
TkFontMetrics *fmPtr;
Tcl_Encoding encoding;
@@ -1564,10 +1564,10 @@ InitFont(
hdc = GetDC(hwnd);
oldFont = SelectObject(hdc, hFont);
- GetTextMetrics(hdc, &tm);
+ GetTextMetricsW(hdc, &tm);
GetTextFaceW(hdc, LF_FACESIZE, buf);
- Tcl_WinTCharToUtf(buf, -1, &faceString);
+ Tcl_WinTCharToUtf((LPCTSTR)buf, -1, &faceString);
fontPtr->font.fid = (Font) fontPtr;
fontPtr->hwnd = hwnd;
@@ -1596,7 +1596,7 @@ InitFont(
encoding = fontPtr->subFontArray[0].familyPtr->encoding;
if (encoding == TkWinGetUnicodeEncoding()) {
- GetCharWidth(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
+ GetCharWidthW(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
} else {
GetCharWidthA(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
}
@@ -1744,7 +1744,7 @@ AllocFontFamily(
hFont = SelectObject(hdc, hFont);
GetTextFaceW(hdc, LF_FACESIZE, buf);
- Tcl_WinTCharToUtf(buf, -1, &faceString);
+ Tcl_WinTCharToUtf((LPCTSTR)buf, -1, &faceString);
faceName = Tk_GetUid(Tcl_DStringValue(&faceString));
Tcl_DStringFree(&faceString);
hFont = SelectObject(hdc, hFont);
@@ -2047,7 +2047,7 @@ WinFontCanUseProc(
fontPtr = canUsePtr->fontPtr;
nameTriedPtr = canUsePtr->nameTriedPtr;
- fallbackName = Tcl_WinTCharToUtf(lfPtr->elfLogFont.lfFaceName, -1, &faceString);
+ fallbackName = Tcl_WinTCharToUtf((LPCTSTR)lfPtr->elfLogFont.lfFaceName, -1, &faceString);
if (SeenName(fallbackName, nameTriedPtr) == 0) {
subFontPtr = CanUseFallback(hdc, fontPtr, fallbackName, ch,
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index 15614a0..a1ab098 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.c
@@ -196,7 +196,7 @@ TkWin32ErrorObj(
*p = '\0';
}
- Tcl_WinTCharToUtf(lpBuffer, -1, &ds);
+ Tcl_WinTCharToUtf((LPCTSTR)lpBuffer, -1, &ds);
errPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index 08c695f..ef4f1bd 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -219,17 +219,8 @@ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError);
*/
#ifndef GetClassLongPtr
-# define GetClassLongPtrA GetClassLongA
# define GetClassLongPtrW GetClassLongW
-# define SetClassLongPtrA SetClassLongA
# define SetClassLongPtrW SetClassLongW
-# ifdef UNICODE
-# define GetClassLongPtr GetClassLongPtrW
-# define SetClassLongPtr SetClassLongPtrW
-# else
-# define GetClassLongPtr GetClassLongPtrA
-# define SetClassLongPtr SetClassLongPtrA
-# endif /* !UNICODE */
#endif /* !GetClassLongPtr */
#ifndef GCLP_HICON
# define GCLP_HICON GCL_HICON
@@ -239,17 +230,8 @@ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError);
#endif /* !GCLP_HICONSM */
#ifndef GetWindowLongPtr
-# define GetWindowLongPtrA GetWindowLongA
# define GetWindowLongPtrW GetWindowLongW
-# define SetWindowLongPtrA SetWindowLongA
# define SetWindowLongPtrW SetWindowLongW
-# ifdef UNICODE
-# define GetWindowLongPtr GetWindowLongPtrW
-# define SetWindowLongPtr SetWindowLongPtrW
-# else
-# define GetWindowLongPtr GetWindowLongPtrW
-# define SetWindowLongPtr SetWindowLongPtrW
-# endif /* !UNICODE */
#endif /* !GetWindowLongPtr */
#ifndef GWLP_WNDPROC
#define GWLP_WNDPROC GWL_WNDPROC
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index c1f9891..234a158 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -187,7 +187,7 @@ KeycodeToKeysym(
BYTE keys[256];
int result, deadkey, shift;
WCHAR buf[4];
- unsigned int scancode = MapVirtualKey(keycode, 0);
+ unsigned int scancode = MapVirtualKeyW(keycode, 0);
/*
* Do not run keycodes of lock keys through ToUnicode(). One of ToUnicode()'s
@@ -201,10 +201,10 @@ KeycodeToKeysym(
}
/*
- * Use MapVirtualKey() to detect some dead keys.
+ * Use MapVirtualKeyW() to detect some dead keys.
*/
- if (MapVirtualKey(keycode, 2) > 0x7fffUL) {
+ if (MapVirtualKeyW(keycode, 2) > 0x7fffUL) {
return XK_Multi_key;
}
@@ -261,10 +261,10 @@ KeycodeToKeysym(
* Get information about the old char
*/
- deadkey = VkKeyScan(buf[0]);
+ deadkey = VkKeyScanW(buf[0]);
shift = deadkey >> 8;
deadkey &= 255;
- scancode = MapVirtualKey(deadkey, 0);
+ scancode = MapVirtualKeyW(deadkey, 0);
/*
* Set up a keyboard with proper modifier keys
@@ -572,7 +572,7 @@ TkpSetKeycodeAndState(
}
}
if (keySym >= 0x20) {
- result = VkKeyScan((WCHAR) keySym);
+ result = VkKeyScanW((WCHAR) keySym);
if (result != -1) {
shift = result >> 8;
if (shift & 1)
@@ -625,7 +625,7 @@ XKeysymToKeycode(
}
}
if (keysym >= 0x20) {
- result = VkKeyScan((WCHAR) keysym);
+ result = VkKeyScanW((WCHAR) keysym);
if (result != -1) {
return (KeyCode) (result & 0xff);
}
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index f93c052..ce9a482 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -573,7 +573,7 @@ ReconfigureWindowsMenu(
TkMenuEntry *mePtr;
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
char *itemText = NULL;
- const WCHAR *lpNewItem;
+ LPCWSTR lpNewItem;
UINT flags;
UINT itemID;
int i, count, systemMenu = 0, base;
@@ -610,7 +610,7 @@ ReconfigureWindowsMenu(
if ((menuPtr->menuType == MENUBAR)
|| (menuPtr->menuFlags & MENU_SYSTEM_MENU)) {
Tcl_WinUtfToTChar(itemText, -1, &translatedText);
- lpNewItem = (const WCHAR *) Tcl_DStringValue(&translatedText);
+ lpNewItem = (LPCWSTR) Tcl_DStringValue(&translatedText);
flags |= MF_STRING;
} else {
lpNewItem = (LPCWSTR) mePtr;
@@ -1003,7 +1003,7 @@ TkWinMenuProc(
LRESULT lResult;
if (!TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, &lResult)) {
- lResult = DefWindowProc(hwnd, message, wParam, lParam);
+ lResult = DefWindowProcW(hwnd, message, wParam, lParam);
}
return lResult;
}
@@ -1102,7 +1102,7 @@ TkWinEmbeddedMenuProc(
}
/* FALLTHRU */
default:
- lResult = DefWindowProc(hwnd, message, wParam, lParam);
+ lResult = DefWindowProcW(hwnd, message, wParam, lParam);
break;
}
return lResult;
@@ -1249,7 +1249,7 @@ TkWinHandleMenuEvent(
if (hashEntryPtr != NULL) {
int i, len, underline;
Tcl_Obj *labelPtr;
- WCHAR *wlabel;
+ LPCWSTR wlabel;
int menuChar;
Tcl_DString ds;
@@ -1272,7 +1272,7 @@ TkWinHandleMenuEvent(
const char *src = Tcl_GetStringFromObj(labelPtr, &len);
Tcl_DStringFree(&ds);
- wlabel = (WCHAR *) Tcl_WinUtfToTChar(src, len, &ds);
+ wlabel = (LPCWSTR) Tcl_WinUtfToTChar(src, len, &ds);
if ((underline < len) && (menuChar ==
Tcl_UniCharToUpper(wlabel[underline]))) {
*plResult = (2 << 16) | i;
@@ -1746,7 +1746,7 @@ DrawWindowsSystemBitmap(
SetTextColor(hdc, gc->foreground);
scratchDC = CreateCompatibleDC(hdc);
- bitmap = LoadBitmap(NULL, MAKEINTRESOURCE(bitmapID));
+ bitmap = LoadBitmapW(NULL, (LPCWSTR)MAKEINTRESOURCE(bitmapID));
SelectObject(scratchDC, bitmap);
SetMapMode(scratchDC, GetMapMode(hdc));
@@ -2099,7 +2099,7 @@ DrawMenuUnderline(
*
* This function is invoked when keys related to pulling down menus is
* pressed. The corresponding Windows events are generated and passed to
- * DefWindowProc if appropriate. This cmd is registered as tk::WinMenuKey
+ * DefWindowProcW if appropriate. This cmd is registered as tk::WinMenuKey
* in the interp.
*
* Results:
@@ -2154,33 +2154,33 @@ TkWinMenuKeyObjCmd(
if (eventPtr->type == KeyPress) {
switch (keySym) {
case XK_Alt_L:
- scanCode = MapVirtualKey(VK_LMENU, 0);
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKeyW(VK_LMENU, 0);
+ CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_MENU,
(int) (scanCode << 16) | (1 << 29));
break;
case XK_Alt_R:
- scanCode = MapVirtualKey(VK_RMENU, 0);
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKeyW(VK_RMENU, 0);
+ CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_MENU,
(int) (scanCode << 16) | (1 << 29) | (1 << 24));
break;
case XK_F10:
- scanCode = MapVirtualKey(VK_F10, 0);
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKeyW(VK_F10, 0);
+ CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_F10, (int) (scanCode << 16));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
- scanCode = MapVirtualKey(virtualKey, 0);
+ scanCode = MapVirtualKeyW(virtualKey, 0);
if (0 != scanCode) {
XKeyEvent xkey = eventPtr->xkey;
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, virtualKey,
(int) ((scanCode << 16) | (1 << 29)));
if (xkey.nbytes > 0) {
for (i = 0; i < xkey.nbytes; i++) {
- CallWindowProc(DefWindowProc,
+ CallWindowProcW(DefWindowProcW,
Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR,
xkey.trans_chars[i],
(int) ((scanCode << 16) | (1 << 29)));
@@ -2191,28 +2191,28 @@ TkWinMenuKeyObjCmd(
} else if (eventPtr->type == KeyRelease) {
switch (keySym) {
case XK_Alt_L:
- scanCode = MapVirtualKey(VK_LMENU, 0);
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKeyW(VK_LMENU, 0);
+ CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31));
break;
case XK_Alt_R:
- scanCode = MapVirtualKey(VK_RMENU, 0);
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKeyW(VK_RMENU, 0);
+ CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24)
| (1 << 29) | (1 << 30) | (1 << 31));
break;
case XK_F10:
- scanCode = MapVirtualKey(VK_F10, 0);
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKeyW(VK_F10, 0);
+ CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_F10,
(int) (scanCode << 16) | (1 << 30) | (1 << 31));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
- scanCode = MapVirtualKey(virtualKey, 0);
+ scanCode = MapVirtualKeyW(virtualKey, 0);
if (0 != scanCode) {
- CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
+ CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, virtualKey, (int) ((scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31)));
}
@@ -3314,7 +3314,7 @@ SetDefaults(
HDC scratchDC;
int bold = 0;
int italic = 0;
- TEXTMETRIC tm;
+ TEXTMETRICW tm;
int pointSize;
HFONT menuFont;
/* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */
@@ -3336,7 +3336,7 @@ SetDefaults(
defaultBorderWidth = GetSystemMetrics(SM_CYBORDER);
}
- scratchDC = CreateDCA("DISPLAY", NULL, NULL, NULL);
+ scratchDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
if (!firstTime) {
Tcl_DStringFree(&menuFontDString);
}
@@ -3350,11 +3350,11 @@ SetDefaults(
nc.metrics.cbSize -= sizeof(int);
}
- SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize,
+ SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize,
&nc.metrics, 0);
menuFont = CreateFontIndirectW(&nc.metrics.lfMenuFont);
SelectObject(scratchDC, menuFont);
- GetTextMetrics(scratchDC, &tm);
+ GetTextMetricsW(scratchDC, &tm);
GetTextFaceA(scratchDC, LF_FACESIZE, faceName);
pointSize = MulDiv(tm.tmHeight - tm.tmInternalLeading,
72, GetDeviceCaps(scratchDC, LOGPIXELSY));
@@ -3411,7 +3411,7 @@ SetDefaults(
*/
showMenuAccelerators = TRUE;
- SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
+ SystemParametersInfoW(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
}
/*
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index 39aeb3b..a633dc2 100644
--- a/win/tkWinScrlbr.c
+++ b/win/tkWinScrlbr.c
@@ -245,7 +245,7 @@ CreateProc(
}
scrollPtr->lastVertical = scrollPtr->info.vertical;
- scrollPtr->oldProc = (WNDPROC)SetWindowLongPtr(scrollPtr->hwnd,
+ scrollPtr->oldProc = (WNDPROC)SetWindowLongPtrW(scrollPtr->hwnd,
GWLP_WNDPROC, (LONG_PTR) ScrollbarProc);
window = Tk_AttachHWND(tkwin, scrollPtr->hwnd);
@@ -291,7 +291,7 @@ TkpDisplayScrollbar(
if (scrollPtr->lastVertical != scrollPtr->info.vertical) {
HWND hwnd = Tk_GetHWND(Tk_WindowId(tkwin));
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) scrollPtr->oldProc);
+ SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR) scrollPtr->oldProc);
DestroyWindow(hwnd);
CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)),
@@ -325,7 +325,7 @@ TkpDestroyScrollbar(
HWND hwnd = winScrollPtr->hwnd;
if (hwnd) {
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) winScrollPtr->oldProc);
+ SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (INT_PTR) winScrollPtr->oldProc);
if (winScrollPtr->winFlags & IN_MODAL_LOOP) {
((TkWindow *)scrollPtr->tkwin)->flags |= TK_DONT_DESTROY_WINDOW;
SetParent(hwnd, NULL);
@@ -568,7 +568,7 @@ ScrollbarProc(
return result;
}
}
- return CallWindowProc(scrollPtr->oldProc, hwnd, message, wParam, lParam);
+ return CallWindowProcW(scrollPtr->oldProc, hwnd, message, wParam, lParam);
}
/*
diff --git a/win/tkWinSend.c b/win/tkWinSend.c
index fca8561..d8ef23b 100644
--- a/win/tkWinSend.c
+++ b/win/tkWinSend.c
@@ -254,7 +254,7 @@ TkGetInterpNames(
if (*p) {
Tcl_DString ds;
- Tcl_WinTCharToUtf(p + 1, -1, &ds);
+ Tcl_WinTCharToUtf((LPCTSTR)(p + 1), -1, &ds);
result = Tcl_ListObjAppendElement(interp,
objList,
Tcl_NewStringObj(Tcl_DStringValue(&ds),
@@ -784,7 +784,7 @@ Send(
ehr = VariantChangeType(&vResult, &vResult, 0, VT_BSTR);
if (SUCCEEDED(ehr)) {
- Tcl_WinTCharToUtf(vResult.bstrVal, (int) SysStringLen(vResult.bstrVal) *
+ Tcl_WinTCharToUtf((LPCTSTR)vResult.bstrVal, SysStringLen(vResult.bstrVal) *
sizeof (WCHAR), &ds);
Tcl_DStringResult(interp, &ds);
}
@@ -797,7 +797,7 @@ Send(
if (hr == DISP_E_EXCEPTION && ei.bstrSource != NULL) {
Tcl_Obj *opError, *opErrorCode, *opErrorInfo;
- Tcl_WinTCharToUtf(ei.bstrSource, (int) SysStringLen(ei.bstrSource) *
+ Tcl_WinTCharToUtf((LPCTSTR)ei.bstrSource, SysStringLen(ei.bstrSource) *
sizeof (WCHAR), &ds);
opError = Tcl_NewStringObj(Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds));
diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c
index 9e5b7a0..3f4f387 100644
--- a/win/tkWinSendCom.c
+++ b/win/tkWinSendCom.c
@@ -385,7 +385,7 @@ Async(
if (SUCCEEDED(hr) && obj->interp) {
Tcl_Obj *scriptPtr;
- Tcl_WinTCharToUtf(vCmd.bstrVal, (int) SysStringLen(vCmd.bstrVal) *
+ Tcl_WinTCharToUtf((LPCTSTR)vCmd.bstrVal, SysStringLen(vCmd.bstrVal) *
sizeof (WCHAR), &ds);
scriptPtr =
Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
@@ -440,8 +440,8 @@ Send(
return hr;
}
- Tcl_WinTCharToUtf(v.bstrVal, (int) SysStringLen(v.bstrVal) *
- sizeof (WCHAR), &ds);
+ Tcl_WinTCharToUtf((LPCTSTR)v.bstrVal, SysStringLen(v.bstrVal) *
+ sizeof(WCHAR), &ds);
scriptPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
Tcl_Preserve(interp);
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 2ea535d..f5cb17c 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -177,7 +177,7 @@ AppendSystemError(
} else {
char *msgPtr;
- Tcl_WinTCharToUtf(wMsgPtr, -1, &ds);
+ Tcl_WinTCharToUtf((LPCTSTR)wMsgPtr, -1, &ds);
LocalFree(wMsgPtr);
msgPtr = Tcl_DStringValue(&ds);
@@ -416,7 +416,7 @@ TestwineventObjCmd(
/*
* testfindwindow title ?class?
- * Find a Windows window using the FindWindow API call. This takes the window
+ * Find a Windows window using the FindWindowW API call. This takes the window
* title and optionally the window class and if found returns the HWND and
* raises an error if the window is not found.
* eg: testfindwindow Console TkTopLevel
@@ -432,7 +432,7 @@ TestfindwindowObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
- const WCHAR *title = NULL, *class = NULL;
+ LPCWSTR title = NULL, class = NULL;
Tcl_DString titleString, classString;
HWND hwnd = NULL;
int r = TCL_OK;
@@ -446,9 +446,9 @@ TestfindwindowObjCmd(
return TCL_ERROR;
}
- title = Tcl_WinUtfToTChar(Tcl_GetString(objv[1]), -1, &titleString);
+ title = (LPCWSTR)Tcl_WinUtfToTChar(Tcl_GetString(objv[1]), -1, &titleString);
if (objc == 3) {
- class = Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
+ class = (LPCWSTR)Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
}
if (title[0] == 0)
title = NULL;
@@ -475,7 +475,7 @@ TestfindwindowObjCmd(
AppendSystemError(interp, GetLastError());
r = TCL_ERROR;
} else {
- Tcl_SetObjResult(interp, Tcl_NewLongObj(PTR2INT(hwnd)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)(((size_t)hwnd) + 1) - 1));
}
Tcl_DStringFree(&titleString);
@@ -491,7 +491,7 @@ EnumChildrenProc(
{
Tcl_Obj *listObj = (Tcl_Obj *) lParam;
- Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj(PTR2INT(hwnd)));
+ Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewWideIntObj((Tcl_WideInt)(((size_t)hwnd) + 1) - 1));
return TRUE;
}
@@ -524,7 +524,7 @@ TestgetwindowinfoObjCmd(
return TCL_ERROR;
} else {
Tcl_DString ds;
- Tcl_WinTCharToUtf(buf, -1, &ds);
+ Tcl_WinTCharToUtf((LPCTSTR)buf, -1, &ds);
classObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
}
@@ -532,16 +532,16 @@ TestgetwindowinfoObjCmd(
dictObj = Tcl_NewDictObj();
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
- Tcl_NewLongObj(GetWindowLongA(INT2PTR(hwnd), GWL_ID)));
+ Tcl_NewWideIntObj(GetWindowLongPtrW(INT2PTR(hwnd), GWL_ID)));
- cch = GetWindowTextW(INT2PTR(hwnd), (LPWSTR)buf, cchBuf);
- Tcl_WinTCharToUtf(buf, cch * sizeof (WCHAR), &ds);
+ cch = GetWindowTextW(INT2PTR(hwnd), buf, cchBuf);
+ Tcl_WinTCharToUtf((LPCTSTR)buf, cch * sizeof (WCHAR), &ds);
textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
- Tcl_NewLongObj(PTR2INT(GetParent((INT2PTR(hwnd))))));
+ Tcl_NewWideIntObj((Tcl_WideInt)(((size_t)GetParent((INT2PTR(hwnd)))) + 1) - 1));
childrenObj = Tcl_NewListObj(0, NULL);
EnumChildWindows(INT2PTR(hwnd), EnumChildrenProc, (LPARAM)childrenObj);
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 167b8ea..dcafd68 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -1013,15 +1013,15 @@ WinSetIcon(
/*
* Don't check return result of SetClassLong() or
- * SetClassLongPtr() since they return the previously set value
+ * SetClassLongPtrW() since they return the previously set value
* which is zero on the initial call or in an error case. The MSDN
* documentation does not indicate that the result needs to be
* checked.
*/
- SetClassLongPtr(hwnd, GCLP_HICONSM,
+ SetClassLongPtrW(hwnd, GCLP_HICONSM,
(LPARAM) GetIcon(titlebaricon, ICON_SMALL));
- SetClassLongPtr(hwnd, GCLP_HICON,
+ SetClassLongPtrW(hwnd, GCLP_HICON,
(LPARAM) GetIcon(titlebaricon, ICON_BIG));
tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -1066,9 +1066,9 @@ WinSetIcon(
return TCL_ERROR;
}
}
- SendMessage(hwnd, WM_SETICON, ICON_SMALL,
+ SendMessageW(hwnd, WM_SETICON, ICON_SMALL,
(LPARAM) GetIcon(titlebaricon, ICON_SMALL));
- SendMessage(hwnd, WM_SETICON, ICON_BIG,
+ SendMessageW(hwnd, WM_SETICON, ICON_BIG,
(LPARAM) GetIcon(titlebaricon, ICON_BIG));
/*
@@ -1157,10 +1157,10 @@ TkWinGetIcon(
* the window class.
*/
- icon = (HICON) SendMessage(wmPtr->wrapper, WM_GETICON, iconsize,
+ icon = (HICON) SendMessageW(wmPtr->wrapper, WM_GETICON, iconsize,
(LPARAM) NULL);
if (icon == (HICON) NULL) {
- icon = (HICON) GetClassLongPtr(wmPtr->wrapper,
+ icon = (HICON) GetClassLongPtrW(wmPtr->wrapper,
(iconsize == ICON_BIG) ? GCLP_HICON : GCLP_HICONSM);
}
return icon;
@@ -1744,7 +1744,7 @@ GetTopLevel(
if (tsdPtr->createWindow) {
return tsdPtr->createWindow;
}
- return (TkWindow *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ return (TkWindow *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
}
/*
@@ -2130,7 +2130,7 @@ UpdateWrapper(
wmPtr->style, x, y, width, height,
parentHWND, NULL, Tk_GetHINSTANCE(), NULL);
Tcl_DStringFree(&titleString);
- SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr);
+ SetWindowLongPtrW(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr);
tsdPtr->createWindow = NULL;
if (wmPtr->exStyleConfig & WS_EX_LAYERED) {
@@ -2181,24 +2181,24 @@ UpdateWrapper(
* doesn't try to set the focus to the child window.
*/
- SetWindowLongPtr(child, GWL_STYLE,
+ SetWindowLongPtrW(child, GWL_STYLE,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
if (winPtr->flags & TK_EMBEDDED) {
- SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc);
+ SetWindowLongPtrW(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc);
}
SetParent(child, wmPtr->wrapper);
if (oldWrapper) {
hSmallIcon = (HICON)
- SendMessage(oldWrapper, WM_GETICON, ICON_SMALL, (LPARAM)NULL);
+ SendMessageW(oldWrapper, WM_GETICON, ICON_SMALL, (LPARAM)NULL);
hBigIcon = (HICON)
- SendMessage(oldWrapper, WM_GETICON, ICON_BIG, (LPARAM) NULL);
+ SendMessageW(oldWrapper, WM_GETICON, ICON_BIG, (LPARAM) NULL);
}
if (oldWrapper && (oldWrapper != wmPtr->wrapper)
&& (oldWrapper != GetDesktopWindow())) {
- SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG_PTR) 0);
+ SetWindowLongPtrW(oldWrapper, GWLP_USERDATA, (LONG_PTR) 0);
if (wmPtr->numTransients > 0) {
/*
@@ -2231,11 +2231,11 @@ UpdateWrapper(
wmPtr->flags &= ~WM_NEVER_MAPPED;
if (winPtr->flags & TK_EMBEDDED &&
- SendMessage(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM) child, 0)) {
- SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ,
+ SendMessageW(wmPtr->wrapper, TK_ATTACHWINDOW, (WPARAM) child, 0)) {
+ SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ,
Tk_ReqWidth((Tk_Window) winPtr),
Tk_ReqHeight((Tk_Window) winPtr));
- SendMessage(wmPtr->wrapper, TK_SETMENU, (WPARAM) wmPtr->hMenu,
+ SendMessageW(wmPtr->wrapper, TK_SETMENU, (WPARAM) wmPtr->hMenu,
(LPARAM) Tk_GetMenuHWND((Tk_Window) winPtr));
}
@@ -2255,11 +2255,11 @@ UpdateWrapper(
wmPtr->hints.initial_state = state;
if (hSmallIcon != NULL) {
- SendMessage(wmPtr->wrapper, WM_SETICON, ICON_SMALL,
+ SendMessageW(wmPtr->wrapper, WM_SETICON, ICON_SMALL,
(LPARAM) hSmallIcon);
}
if (hBigIcon != NULL) {
- SendMessage(wmPtr->wrapper, WM_SETICON, ICON_BIG, (LPARAM) hBigIcon);
+ SendMessageW(wmPtr->wrapper, WM_SETICON, ICON_BIG, (LPARAM) hBigIcon);
}
/*
@@ -2271,7 +2271,7 @@ UpdateWrapper(
*/
if (winPtr->flags & TK_EMBEDDED) {
- if (state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) {
+ if (state+1 != SendMessageW(wmPtr->wrapper, TK_STATE, state, 0)) {
TkpWmSetState(winPtr, NormalState);
wmPtr->hints.initial_state = NormalState;
}
@@ -2701,7 +2701,7 @@ TkWmDeadWindow(
}
} else {
if (wmPtr->wrapper != NULL) {
- SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0);
+ SendMessageW(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0);
}
}
if (wmPtr->iconPtr != NULL) {
@@ -3188,7 +3188,7 @@ WmAttributesCmd(
*/
if (!(wmPtr->exStyleConfig & WS_EX_LAYERED)) {
- SetWindowLongPtr(wmPtr->wrapper, GWL_EXSTYLE,
+ SetWindowLongPtrW(wmPtr->wrapper, GWL_EXSTYLE,
*stylePtr);
}
SetLayeredWindowAttributes((HWND) wmPtr->wrapper,
@@ -3567,7 +3567,7 @@ WmDeiconifyCmd(
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
- if (!SendMessage(wmPtr->wrapper, TK_DEICONIFY, 0, 0)) {
+ if (!SendMessageW(wmPtr->wrapper, TK_DEICONIFY, 0, 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't deiconify %s: the container does not support the request",
winPtr->pathName));
@@ -3711,6 +3711,7 @@ WmFrameCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
HWND hwnd;
+ char buf[TCL_INTEGER_SPACE];
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -3723,7 +3724,8 @@ WmFrameCmd(
if (hwnd == NULL) {
hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr));
}
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", PTR2INT(hwnd)));
+ sprintf(buf, "0x%" TCL_Z_MODIFIER "x", (size_t)hwnd);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));
return TCL_OK;
}
@@ -3775,7 +3777,7 @@ WmGeometryCmd(
height = winPtr->changes.height;
}
if (winPtr->flags & TK_EMBEDDED) {
- int result = SendMessage(wmPtr->wrapper, TK_MOVEWINDOW, -1, -1);
+ int result = SendMessageW(wmPtr->wrapper, TK_MOVEWINDOW, -1, -1);
wmPtr->x = result >> 16;
wmPtr->y = result & 0x0000ffff;
@@ -4124,7 +4126,7 @@ WmIconifyCmd(
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
- if (!SendMessage(wmPtr->wrapper, TK_ICONIFY, 0, 0)) {
+ if (!SendMessageW(wmPtr->wrapper, TK_ICONIFY, 0, 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify %s: the container does not support the request",
winPtr->pathName));
@@ -4817,7 +4819,7 @@ WmOverrideredirectCmd(
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
- curValue = SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1;
+ curValue = SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1;
if (curValue < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Container does not support overrideredirect", -1));
@@ -4836,7 +4838,7 @@ WmOverrideredirectCmd(
}
if (curValue != boolean) {
if (winPtr->flags & TK_EMBEDDED) {
- SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0);
+ SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0);
} else {
/*
* Only do this if we are really changing value, because it causes
@@ -5350,7 +5352,7 @@ WmStateCmd(
Tcl_Panic("unexpected index");
}
- if (state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) {
+ if (state+1 != SendMessageW(wmPtr->wrapper, TK_STATE, state, 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't change state of %s: the container does not support the request",
winPtr->pathName));
@@ -5403,7 +5405,7 @@ WmStateCmd(
int state;
if (winPtr->flags & TK_EMBEDDED) {
- state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1) - 1;
+ state = SendMessageW(wmPtr->wrapper, TK_STATE, -1, -1) - 1;
} else {
state = wmPtr->hints.initial_state;
}
@@ -5455,7 +5457,7 @@ WmTitleCmd(
}
if (winPtr->flags & TK_EMBEDDED) {
- wrapper = (HWND) SendMessage(wmPtr->wrapper, TK_GETFRAMEWID, 0, 0);
+ wrapper = (HWND) SendMessageW(wmPtr->wrapper, TK_GETFRAMEWID, 0, 0);
} else {
wrapper = wmPtr->wrapper;
}
@@ -5466,7 +5468,7 @@ WmTitleCmd(
int size = 256;
GetWindowTextW(wrapper, buf, size);
- Tcl_WinTCharToUtf(buf, -1, &titleString);
+ Tcl_WinTCharToUtf((LPCTSTR)buf, -1, &titleString);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tcl_DStringValue(&titleString),
Tcl_DStringLength(&titleString)));
@@ -5663,7 +5665,7 @@ WmWithdrawCmd(
}
if (winPtr->flags & TK_EMBEDDED) {
- if (SendMessage(wmPtr->wrapper, TK_WITHDRAW, 0, 0) < 0) {
+ if (SendMessageW(wmPtr->wrapper, TK_WITHDRAW, 0, 0) < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't withdraw %s: the container does not support the request",
Tcl_GetString(objv[2])));
@@ -5968,7 +5970,7 @@ TopLevelReqProc(
wmPtr = winPtr->wmInfoPtr;
if (wmPtr) {
if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) {
- SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
+ SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
Tk_ReqHeight(tkwin));
}
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
@@ -6180,8 +6182,8 @@ UpdateGeometryInfo(
* be ignored.
*/
- SendMessage(wmPtr->wrapper, TK_MOVEWINDOW, x, y);
- SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, width, height);
+ SendMessageW(wmPtr->wrapper, TK_MOVEWINDOW, x, y);
+ SendMessageW(wmPtr->wrapper, TK_GEOMETRYREQ, width, height);
} else {
int reqHeight, reqWidth;
RECT windowRect;
@@ -6876,7 +6878,7 @@ TkWmRestackToplevel(
}
if (winPtr->flags & TK_EMBEDDED) {
- SendMessage(winPtr->wmInfoPtr->wrapper, TK_RAISEWINDOW,
+ SendMessageW(winPtr->wmInfoPtr->wrapper, TK_RAISEWINDOW,
(WPARAM) insertAfter, aboveBelow);
} else {
TkWinSetWindowPos(hwnd, insertAfter, aboveBelow);
@@ -7102,7 +7104,7 @@ TkWinSetMenu(
wmPtr->flags |= WM_UPDATE_PENDING|WM_MOVE_PENDING;
}
} else {
- SendMessage(wmPtr->wrapper, TK_SETMENU, (WPARAM) hMenu,
+ SendMessageW(wmPtr->wrapper, TK_SETMENU, (WPARAM) hMenu,
(LPARAM) Tk_GetMenuHWND(tkwin));
}
}
@@ -7416,7 +7418,7 @@ InstallColormaps(
SelectPalette(dc, oldPalette, TRUE);
RealizePalette(dc);
ReleaseDC(hwnd, dc);
- SendMessage(hwnd, WM_PALETTECHANGED, (WPARAM) hwnd, (LPARAM) NULL);
+ SendMessageW(hwnd, WM_PALETTECHANGED, (WPARAM) hwnd, (LPARAM) NULL);
return TRUE;
}
} else {
@@ -7812,7 +7814,7 @@ TopLevelProc(
winPtr->changes.height = pos->cy;
}
if (!(pos->flags & SWP_NOMOVE)) {
- long result = SendMessage(winPtr->wmInfoPtr->wrapper,
+ long result = SendMessageW(winPtr->wmInfoPtr->wrapper,
TK_MOVEWINDOW, -1, -1);
winPtr->wmInfoPtr->x = winPtr->changes.x = result >> 16;
winPtr->wmInfoPtr->y = winPtr->changes.y = result & 0xffff;
@@ -8003,7 +8005,7 @@ WmProc(
* 2272]
*/
- result = DefWindowProc(hwnd, message, wParam, lParam);
+ result = DefWindowProcW(hwnd, message, wParam, lParam);
goto done;
}
@@ -8080,7 +8082,7 @@ WmProc(
HWND hMenuHWnd = Tk_GetEmbeddedMenuHWND((Tk_Window) winPtr);
if (hMenuHWnd) {
- if (SendMessage(hMenuHWnd, message, wParam, lParam)) {
+ if (SendMessageW(hMenuHWnd, message, wParam, lParam)) {
goto done;
}
} else if (TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam,
@@ -8099,10 +8101,10 @@ WmProc(
result = 0;
} else if (!Tk_TranslateWinEvent(child, message, wParam, lParam,
&result)) {
- result = DefWindowProc(hwnd, message, wParam, lParam);
+ result = DefWindowProcW(hwnd, message, wParam, lParam);
}
} else {
- result = DefWindowProc(hwnd, message, wParam, lParam);
+ result = DefWindowProcW(hwnd, message, wParam, lParam);
}
done:
@@ -8616,10 +8618,10 @@ TkpWinToplevelDetachWindow(
register WmInfo *wmPtr = winPtr->wmInfoPtr;
if (winPtr->flags & TK_EMBEDDED) {
- int state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1) - 1;
+ int state = SendMessageW(wmPtr->wrapper, TK_STATE, -1, -1) - 1;
- SendMessage(wmPtr->wrapper, TK_SETMENU, 0, 0);
- SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0);
+ SendMessageW(wmPtr->wrapper, TK_SETMENU, 0, 0);
+ SendMessageW(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0);
winPtr->flags &= ~TK_EMBEDDED;
winPtr->privatePtr = NULL;
wmPtr->wrapper = NULL;
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 5617db9..58fe754 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -780,7 +780,7 @@ TkWinChildProc(
case WM_IME_COMPOSITION:
result = 0;
if (HandleIMEComposition(hwnd, lParam) == 0) {
- result = DefWindowProc(hwnd, message, wParam, lParam);
+ result = DefWindowProcW(hwnd, message, wParam, lParam);
}
break;
@@ -800,7 +800,7 @@ TkWinChildProc(
case WM_PAINT:
GenerateXEvent(hwnd, message, wParam, lParam);
- result = DefWindowProc(hwnd, message, wParam, lParam);
+ result = DefWindowProcW(hwnd, message, wParam, lParam);
break;
case TK_CLAIMFOCUS:
@@ -837,7 +837,7 @@ TkWinChildProc(
default:
if (!Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
- result = DefWindowProc(hwnd, message, wParam, lParam);
+ result = DefWindowProcW(hwnd, message, wParam, lParam);
}
break;
}
@@ -918,7 +918,7 @@ Tk_TranslateWinEvent(
? ((NMHDR*)lParam)->hwndFrom : (HWND) lParam;
if (target && target != hwnd) {
- *resultPtr = SendMessage(target, message, wParam, lParam);
+ *resultPtr = SendMessageW(target, message, wParam, lParam);
return 1;
}
break;
@@ -1311,10 +1311,10 @@ GenerateXEvent(
if (IsDBCSLeadByte((BYTE) wParam)) {
MSG msg;
- if ((PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR,
+ if ((PeekMessageW(&msg, NULL, WM_CHAR, WM_CHAR,
PM_NOREMOVE) != 0)
&& (msg.message == WM_CHAR)) {
- GetMessage(&msg, NULL, WM_CHAR, WM_CHAR);
+ GetMessageW(&msg, NULL, WM_CHAR, WM_CHAR);
event.xkey.nbytes = 2;
event.xkey.trans_chars[1] = (char) msg.wParam;
}
@@ -1536,7 +1536,7 @@ UpdateInputLanguage(
return;
}
- wsprintfA(codepage, "cp%d", charsetInfo.ciACP);
+ sprintf(codepage, "cp%d", charsetInfo.ciACP);
if ((encoding = Tcl_GetEncoding(NULL, codepage)) == NULL) {
/*
@@ -1616,7 +1616,7 @@ TkWinGetUnicodeEncoding(void)
*
* When an Input Method Editor (IME) is ready to send input characters to
* an application, it sends a WM_IME_COMPOSITION message with the
- * GCS_RESULTSTR. However, The DefWindowProc() on English Windows 2000
+ * GCS_RESULTSTR. However, The DefWindowProcW() on English Windows 2000
* arbitrarily converts all non-Latin-1 characters in the composition to
* "?".
*
@@ -1655,7 +1655,7 @@ HandleIMEComposition(
return 0;
}
- n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0);
+ n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
if (n > 0) {
WCHAR *buff = (WCHAR *) ckalloc(n);
@@ -1663,7 +1663,7 @@ HandleIMEComposition(
XEvent event;
int i;
- n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n) / 2;
+ n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, (unsigned) n) / 2;
/*
* Set up the fields pertinent to key event.
@@ -1821,7 +1821,7 @@ TkWinResendEvent(
}
lparam = MAKELPARAM((short) eventPtr->xbutton.x,
(short) eventPtr->xbutton.y);
- return CallWindowProc(wndproc, hwnd, msg, wparam, lparam);
+ return CallWindowProcW(wndproc, hwnd, msg, wparam, lparam);
}
/*
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index 8bcfca2..ae026b3 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -92,7 +92,7 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp)
hwnd = CreateWindowW( name, title, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hinst, NULL );
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) interp);
+ SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) interp);
ShowWindow(hwnd, SW_HIDE);
UpdateWindow(hwnd);
}
@@ -109,7 +109,7 @@ DestroyThemeMonitorWindow(void *clientData)
static LRESULT WINAPI
WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
- Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
Ttk_Theme theme;
switch (msg) {
@@ -137,7 +137,7 @@ WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
}
break;
}
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcW(hwnd, msg, wp, lp);
}
/*
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index c877c09..1375bb6 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -1115,7 +1115,7 @@ Ttk_CreateVsapiElement(
XPThemeData *themeData = clientData;
ElementInfo *elementPtr = NULL;
ClientData elementData;
- WCHAR *className;
+ LPCWSTR className;
int partId = 0;
Ttk_StateTable *stateTable;
Ttk_Padding pad = {0, 0, 0, 0};
@@ -1143,7 +1143,7 @@ Ttk_CreateVsapiElement(
return TCL_ERROR;
}
name = Tcl_GetStringFromObj(objv[0], &length);
- className = (WCHAR *) Tcl_WinUtfToTChar(name, length, &classBuf);
+ className = (LPCWSTR) Tcl_WinUtfToTChar(name, length, &classBuf);
/* flags or padding */
if (objc > 3) {