diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-17 13:21:10 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-17 13:21:10 (GMT) |
commit | 4e389557600c1aa77d7991114d9e9fcc5ba24d46 (patch) | |
tree | 2885374f28652e990dc9d83c1ad73d7d3fc2f9c9 /win/tkWinTest.c | |
parent | b8b8de56e290dd3d82585190651360c843542e7b (diff) | |
parent | 8abb78aec188d72fbbd9bda28f1f9702ad3b60e5 (diff) | |
download | tk-4e389557600c1aa77d7991114d9e9fcc5ba24d46.zip tk-4e389557600c1aa77d7991114d9e9fcc5ba24d46.tar.gz tk-4e389557600c1aa77d7991114d9e9fcc5ba24d46.tar.bz2 |
Merge 8.7
Diffstat (limited to 'win/tkWinTest.c')
-rw-r--r-- | win/tkWinTest.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 544f89c..4e993af 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -98,10 +98,10 @@ HWND TestFindControl(HWND root, int id) fcs.control = GetDlgItem(root, id); if (fcs.control == NULL) { - /* Control is not a direct child. Look in descendents */ - fcs.id = id; - fcs.control = NULL; - EnumChildWindows(root, TestFindControlCallback, (LPARAM) &fcs); + /* Control is not a direct child. Look in descendents */ + fcs.id = id; + fcs.control = NULL; + EnumChildWindows(root, TestFindControlCallback, (LPARAM) &fcs); } return fcs.control; } @@ -360,15 +360,15 @@ TestwineventObjCmd( #if 0 GetDlgItemTextA(hwnd, id, buf, 256); #else - control = TestFindControl(hwnd, id); - if (control == NULL) { - Tcl_SetObjResult(interp, - Tcl_ObjPrintf("Could not find control with id %d", id)); - return TCL_ERROR; - } - buf[0] = 0; - SendMessageA(control, WM_GETTEXT, (WPARAM)sizeof(buf), - (LPARAM) buf); + control = TestFindControl(hwnd, id); + if (control == NULL) { + Tcl_SetObjResult(interp, + Tcl_ObjPrintf("Could not find control with id %d", id)); + return TCL_ERROR; + } + buf[0] = 0; + SendMessageA(control, WM_GETTEXT, (WPARAM)sizeof(buf), + (LPARAM) buf); #endif Tcl_AppendResult(interp, Tcl_ExternalToUtfDString(NULL, buf, TCL_INDEX_NONE, &ds), NULL); Tcl_DStringFree(&ds); @@ -443,8 +443,8 @@ TestfindwindowObjCmd( Tcl_DStringInit(&titleString); if (objc < 2 || objc > 3) { - Tcl_WrongNumArgs(interp, 1, objv, "title ?class?"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "title ?class?"); + return TCL_ERROR; } Tcl_DStringInit(&titleString); @@ -454,23 +454,23 @@ TestfindwindowObjCmd( windowClass = Tcl_UtfToWCharDString(Tcl_GetString(objv[2]), TCL_INDEX_NONE, &classString); } if (title[0] == 0) - title = NULL; + title = NULL; /* We want find a window the belongs to us and not some other process */ hwnd = NULL; myPid = GetCurrentProcessId(); while (1) { - DWORD pid, tid; - hwnd = FindWindowExW(NULL, hwnd, windowClass, title); - if (hwnd == NULL) - break; - tid = GetWindowThreadProcessId(hwnd, &pid); - if (tid == 0) { - /* Window has gone */ - hwnd = NULL; - break; - } - if (pid == myPid) - break; /* Found it */ + DWORD pid, tid; + hwnd = FindWindowExW(NULL, hwnd, windowClass, title); + if (hwnd == NULL) + break; + tid = GetWindowThreadProcessId(hwnd, &pid); + if (tid == 0) { + /* Window has gone */ + hwnd = NULL; + break; + } + if (pid == myPid) + break; /* Found it */ } if (hwnd == NULL) { @@ -478,7 +478,7 @@ TestfindwindowObjCmd( AppendSystemError(interp, GetLastError()); r = TCL_ERROR; } else { - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd))); } Tcl_DStringFree(&titleString); |