summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tkWinDialog.c4
-rw-r--r--win/tkWinEmbed.c16
-rw-r--r--win/tkWinMenu.c8
-rw-r--r--win/tkWinTest.c16
-rw-r--r--win/tkWinWm.c2
-rw-r--r--win/tkWinX.c12
6 files changed, 29 insertions, 29 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index ba4c2df..6940f1b 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1016,10 +1016,10 @@ OFNHookProc(
ofnData->dynFileBuffer = (char *) buffer;
}
- SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, (int) buffer);
+ SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, PTR2INT(buffer));
buffer += dirsize;
- SendMessage(hdlg, CDM_GETSPEC, selsize, (int) buffer);
+ SendMessage(hdlg, CDM_GETSPEC, selsize, PTR2INT(buffer));
/*
* If there are multiple files, delete the quotes and change
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 1a6ece3..43cd419 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -259,7 +259,7 @@ TkpUseWindow(
if (Tcl_GetInt(interp, string, &id) != TCL_OK) {
return TCL_ERROR;
}
- hwnd = (HWND) id;
+ hwnd = (HWND) INT2PTR(id);
if ((HWND)winPtr->privatePtr == hwnd) {
return TCL_OK;
}
@@ -279,12 +279,12 @@ TkpUseWindow(
}
id = SendMessage(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0);
- if (id == (long)hwnd) {
+ if (id == PTR2INT(hwnd)) {
if (!SendMessage(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) {
Tcl_AppendResult(interp, "The container is already in use", NULL);
return TCL_ERROR;
}
- } else if (id == -(long)hwnd) {
+ } else if (id == -PTR2INT(hwnd)) {
Tcl_AppendResult(interp, "the window to use is not a Tk container",
NULL);
return TCL_ERROR;
@@ -457,7 +457,7 @@ TkWinEmbeddedEventProc(
result = containerPtr->embeddedHWnd == NULL? 1:0;
break;
case TK_CONTAINER_VERIFY:
- result = (long)containerPtr->parentHWnd;
+ result = PTR2INT(containerPtr->parentHWnd);
break;
default:
result = 0;
@@ -495,7 +495,7 @@ TkWinEmbeddedEventProc(
}
containerPtr->embeddedHWnd = (HWND)wParam;
}
- result = (long)containerPtr->parentHWnd;
+ result = PTR2INT(containerPtr->parentHWnd);
} else {
result = 0;
}
@@ -568,14 +568,14 @@ TkWinEmbeddedEventProc(
* returned.
*/
if (topwinPtr) {
- result = (long)GetParent(containerPtr->parentHWnd);
+ result = PTR2INT(GetParent(containerPtr->parentHWnd));
} else {
topwinPtr = containerPtr->parentPtr;
while (!(topwinPtr->flags & TK_TOP_HIERARCHY)) {
topwinPtr = topwinPtr->parentPtr;
}
if (topwinPtr && topwinPtr->window) {
- result = (long)GetParent(Tk_GetHWND(topwinPtr->window));
+ result = PTR2INT(GetParent(Tk_GetHWND(topwinPtr->window)));
} else {
result = 0;
}
@@ -759,7 +759,7 @@ TkWinEmbeddedEventProc(
* Reply the message sender: this is not a Tk container
*/
- return -(long)hwnd;
+ return -PTR2INT(hwnd);
} else {
result = 0;
}
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 62bbcc2..79642f5 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -436,7 +436,7 @@ TkpDestroyMenuEntry(
Tcl_DoWhenIdle(ReconfigureWindowsMenu, (ClientData) menuPtr);
}
}
- FreeID((WORD) (UINT) mePtr->platformEntryData);
+ FreeID((WORD) PTR2INT(mePtr->platformEntryData));
mePtr->platformEntryData = NULL;
}
@@ -625,7 +625,7 @@ ReconfigureWindowsMenu(
flags |= MF_MENUBREAK;
}
- itemID = (UINT) mePtr->platformEntryData;
+ itemID = PTR2INT(mePtr->platformEntryData);
if ((mePtr->type == CASCADE_ENTRY)
&& (mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
@@ -645,7 +645,7 @@ ReconfigureWindowsMenu(
* If the MF_POPUP flag is set, then the id is interpreted
* as the handle of a submenu.
*/
- itemID = (UINT) childMenuHdl;
+ itemID = PTR2INT(childMenuHdl);
}
}
if ((menuPtr->menuType == MENUBAR)
@@ -855,7 +855,7 @@ TkpMenuNewEntry(
Tcl_DoWhenIdle(ReconfigureWindowsMenu, (ClientData) menuPtr);
}
- mePtr->platformEntryData = (TkMenuPlatformEntryData) (UINT) commandID;
+ mePtr->platformEntryData = (TkMenuPlatformEntryData) INT2PTR(commandID);
return TCL_OK;
}
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 29a2ba6..f9cd350 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -300,7 +300,7 @@ TestwineventCmd(
return TCL_ERROR;
}
#endif
- hwnd = (HWND) strtol(argv[1], &rest, 0);
+ hwnd = INT2PTR(strtol(argv[1], &rest, 0));
if (rest == argv[1]) {
hwnd = FindWindowA(NULL, argv[1]);
if (hwnd == NULL) {
@@ -424,7 +424,7 @@ TestfindwindowObjCmd(
AppendSystemError(interp, GetLastError());
r = TCL_ERROR;
} else {
- Tcl_SetObjResult(interp, Tcl_NewLongObj((long)hwnd));
+ Tcl_SetObjResult(interp, Tcl_NewLongObj(PTR2INT(hwnd)));
}
Tcl_DStringFree(&titleString);
@@ -440,7 +440,7 @@ EnumChildrenProc(
{
Tcl_Obj *listObj = (Tcl_Obj *) lParam;
- Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj((long) hwnd));
+ Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj(PTR2INT(hwnd)));
return TRUE;
}
@@ -465,7 +465,7 @@ TestgetwindowinfoObjCmd(
if (Tcl_GetLongFromObj(interp, objv[1], &hwnd) != TCL_OK)
return TCL_ERROR;
- cch = tkTestWinProcs->getClassName((HWND)hwnd, buf, cchBuf);
+ cch = tkTestWinProcs->getClassName(INT2PTR(hwnd), buf, cchBuf);
if (cch == 0) {
Tcl_SetResult(interp, "failed to get class name: ", TCL_STATIC);
AppendSystemError(interp, GetLastError());
@@ -480,17 +480,17 @@ TestgetwindowinfoObjCmd(
dictObj = Tcl_NewDictObj();
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
- Tcl_NewLongObj(GetWindowLongA((HWND)hwnd, GWL_ID)));
+ Tcl_NewLongObj(GetWindowLongA(INT2PTR(hwnd), GWL_ID)));
- cch = tkTestWinProcs->getWindowText((HWND)hwnd, (LPTSTR)buf, cchBuf);
+ cch = tkTestWinProcs->getWindowText(INT2PTR(hwnd), (LPTSTR)buf, cchBuf);
textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
- Tcl_NewLongObj((long)GetParent((HWND)hwnd)));
+ Tcl_NewLongObj(PTR2INT(GetParent((INT2PTR(hwnd))))));
childrenObj = Tcl_NewListObj(0, NULL);
- EnumChildWindows((HWND)hwnd, EnumChildrenProc, (LPARAM)childrenObj);
+ EnumChildWindows(INT2PTR(hwnd), EnumChildrenProc, (LPARAM)childrenObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("children", -1), childrenObj);
Tcl_SetObjResult(interp, dictObj);
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 53f8ee6..e4c9c34 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -3691,7 +3691,7 @@ WmFrameCmd(
if (hwnd == NULL) {
hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr));
}
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", (unsigned) hwnd));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", PTR2INT(hwnd)));
return TCL_OK;
}
diff --git a/win/tkWinX.c b/win/tkWinX.c
index a847938..f74ac52 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -260,10 +260,10 @@ TkWinXInit(
* Initialize input language info
*/
- if (GetLocaleInfo(LANGIDFROMLCID((DWORD)GetKeyboardLayout(0)),
+ if (GetLocaleInfo(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))),
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
(LPTSTR) &lpCP, sizeof(lpCP)/sizeof(TCHAR))
- && TranslateCharsetInfo((DWORD *)lpCP, &lpCs, TCI_SRCCODEPAGE)) {
+ && TranslateCharsetInfo(INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) {
UpdateInputLanguage((int) lpCs.ciCharset);
}
@@ -484,8 +484,8 @@ TkWinDisplayChanged(
* the HWND and we'll just get blank spots copied onto the screen.
*/
- screen->ext_data = (XExtData *) GetDeviceCaps(dc, PLANES);
- screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * (int) screen->ext_data;
+ screen->ext_data = INT2PTR(GetDeviceCaps(dc, PLANES));
+ screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data);
if (screen->root_visual != NULL) {
ckfree(screen->root_visual);
@@ -1428,7 +1428,7 @@ UpdateInputLanguage(
if (keyInputCharset == charset) {
return;
}
- if (TranslateCharsetInfo((DWORD*)charset, &charsetInfo,
+ if (TranslateCharsetInfo(INT2PTR(charset), &charsetInfo,
TCI_SRCCHARSET) == 0) {
/*
* Some mysterious failure.
@@ -1916,7 +1916,7 @@ Tk_ResetUserInactiveTime(
inp.mi.mouseData = 0;
inp.mi.dwFlags = MOUSEEVENTF_MOVE;
inp.mi.time = 0;
- inp.mi.dwExtraInfo = (DWORD) NULL;
+ inp.mi.dwExtraInfo = (DWORD) 0;
SendInput(1, &inp, sizeof(inp));
}