Changeset 7801 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- Feb 5, 2002, 6:59:31 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r7780 r7801 1 /* $Id: win32wbase.cpp,v 1.31 2 2002-01-20 15:26:21sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.313 2002-02-05 17:59:00 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 169 169 fIsModalDialogOwner = FALSE; 170 170 OS2HwndModalDialog = 0; 171 fInternalMsg = FALSE;172 171 fParentChange = FALSE; 173 172 fDestroyWindowCalled = FALSE; … … 212 211 hotkey = 0; 213 212 214 215 213 hwndLinkAfter = HWND_BOTTOM; 216 214 flags = 0; 217 lastHitTestVal = HT OS_NORMAL;215 lastHitTestVal = HTCLIENT; 218 216 owner = NULL; 219 217 windowClass = 0; … … 846 844 if(!(flags & WIN_NEED_SIZE)) 847 845 { 848 Send InternalMessageA(WM_SIZE, SIZE_RESTORED,849 850 846 SendMessageA(getWindowHandle(), WM_SIZE, SIZE_RESTORED, 847 MAKELONG(rectClient.right-rectClient.left, 848 rectClient.bottom-rectClient.top)); 851 849 852 850 if(!::IsWindow(hwnd)) … … 855 853 goto end; 856 854 } 857 Send InternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));855 SendMessageA(getWindowHandle(), WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top)); 858 856 if(!::IsWindow(hwnd)) 859 857 { … … 883 881 if(getParent() && getParent()->IsWindowDestroyed() == FALSE) 884 882 { 885 getParent()->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle());883 SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle()); 886 884 } 887 885 if(!::IsWindow(hwnd)) … … 914 912 ULONG Win32BaseWindow::MsgQuit() 915 913 { 916 return Send InternalMessageA(WM_QUIT, 0, 0);914 return SendMessageA(getWindowHandle(), WM_QUIT, 0, 0); 917 915 } 918 916 //****************************************************************************** … … 920 918 ULONG Win32BaseWindow::MsgClose() 921 919 { 922 return Send InternalMessageA(WM_CLOSE,0,0);920 return SendMessageA(getWindowHandle(), WM_CLOSE,0,0); 923 921 } 924 922 //****************************************************************************** … … 940 938 { 941 939 /* Notify the parent window only */ 942 getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());940 SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle()); 943 941 } 944 942 //// else DebugInt3(); 945 943 } 946 944 } 947 Send InternalMessageA(WM_DESTROY, 0, 0);945 SendMessageA(getWindowHandle(),WM_DESTROY, 0, 0); 948 946 if(::IsWindow(hwnd) == FALSE) { 949 947 //object already destroyed, so return immediately 950 948 return 1; 951 949 } 952 Send InternalMessageA(WM_NCDESTROY, 0, 0);950 SendMessageA(getWindowHandle(),WM_NCDESTROY, 0, 0); 953 951 954 952 TIMER_KillTimerFromWindow(getWindowHandle()); … … 979 977 else dwStyle |= WS_DISABLED; 980 978 981 return Send InternalMessageA(WM_ENABLE, fEnable, 0);979 return SendMessageA(getWindowHandle(),WM_ENABLE, fEnable, 0); 982 980 } 983 981 //****************************************************************************** … … 999 997 1000 998 //already sent from ShowWindow 1001 //// return Send InternalMessageA(WM_SHOWWINDOW, fShow, 0);999 //// return SendMessageA(getWindowHandle(),WM_SHOWWINDOW, fShow, 0); 1002 1000 return 0; 1003 1001 } … … 1011 1009 return 0; 1012 1010 1013 return Send InternalMessageA(WM_WINDOWPOSCHANGING, 0, lp);1011 return SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGING, 0, lp); 1014 1012 } 1015 1013 //****************************************************************************** … … 1022 1020 return 1; 1023 1021 1024 return Send InternalMessageA(WM_WINDOWPOSCHANGED, 0, lp);1022 return SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGED, 0, lp); 1025 1023 } 1026 1024 //****************************************************************************** … … 1030 1028 //According to the SDK docs, the scrollbar handle (lParam) is 0 when the standard 1031 1029 //window scrollbars send these messages 1032 return Send InternalMessageA(msg, MAKELONG(scrollCode, scrollPos), 0);1030 return SendMessageA(getWindowHandle(),msg, MAKELONG(scrollCode, scrollPos), 0); 1033 1031 } 1034 1032 //****************************************************************************** … … 1046 1044 //default processing is cancelled 1047 1045 //TODO: According to Wine we should proceed anyway if window is sysmodal 1048 if(Send InternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)1046 if(SendMessageA(getWindowHandle(),WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate) 1049 1047 { 1050 1048 dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing")); … … 1055 1053 { 1056 1054 if(fActivate) {//WM_CHILDACTIVE is for activation only 1057 Send InternalMessageA(WM_CHILDACTIVATE, 0, 0L);1055 SendMessageA(getWindowHandle(),WM_CHILDACTIVATE, 0, 0L); 1058 1056 } 1059 1057 return 0; 1060 1058 } 1061 1059 1062 return Send InternalMessageA(WM_ACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd);1060 return SendMessageA(getWindowHandle(),WM_ACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd); 1063 1061 } 1064 1062 //****************************************************************************** … … 1074 1072 //default processing is cancelled 1075 1073 //TODO: According to Wine we should proceed anyway if window is sysmodal 1076 if(Send InternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)1074 if(SendMessageA(getWindowHandle(),WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate) 1077 1075 { 1078 1076 dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing")); … … 1083 1081 { 1084 1082 if(fActivate) {//WM_CHILDACTIVE is for activation only 1085 Send InternalMessageA(WM_CHILDACTIVATE, 0, 0L);1083 SendMessageA(getWindowHandle(),WM_CHILDACTIVATE, 0, 0L); 1086 1084 } 1087 1085 return 0; … … 1094 1092 ULONG Win32BaseWindow::DispatchMsgA(MSG *msg) 1095 1093 { 1096 return Send InternalMessageA(msg->message, msg->wParam, msg->lParam);1094 return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam); 1097 1095 } 1098 1096 //****************************************************************************** … … 1100 1098 ULONG Win32BaseWindow::DispatchMsgW(MSG *msg) 1101 1099 { 1102 return Send InternalMessageW(msg->message, msg->wParam, msg->lParam);1100 return SendMessageW(getWindowHandle(), msg->message, msg->wParam, msg->lParam); 1103 1101 } 1104 1102 //****************************************************************************** … … 1111 1109 } 1112 1110 1113 return SendInternalMessageA(WM_SETFOCUS, hwnd, 0);1111 return SendMessageA(getWindowHandle(),WM_SETFOCUS, hwnd, 0); 1114 1112 } 1115 1113 //****************************************************************************** … … 1121 1119 return 0; 1122 1120 } 1123 return Send InternalMessageA(WM_KILLFOCUS, hwnd, 0);1121 return SendMessageA(getWindowHandle(),WM_KILLFOCUS, hwnd, 0); 1124 1122 } 1125 1123 //****************************************************************************** … … 1130 1128 1131 1129 dprintf(("MsgButton %d at (%d,%d)", msg->message, msg->pt.x, msg->pt.y)); 1132 switch(msg->message) { 1130 switch(msg->message) 1131 { 1133 1132 case WM_LBUTTONDBLCLK: 1134 1133 case WM_RBUTTONDBLCLK: … … 1167 1166 if (hwndTop && (getWindowHandle() != hwndActive)) 1168 1167 { 1169 LONG ret = Send InternalMessageA(WM_MOUSEACTIVATE, hwndTop,1170 1168 LONG ret = SendMessageA(getWindowHandle(),WM_MOUSEACTIVATE, hwndTop, 1169 MAKELONG( lastHitTestVal, msg->message) ); 1171 1170 1172 1171 dprintf2(("WM_MOUSEACTIVATE returned %d", ret)); … … 1192 1191 } 1193 1192 1194 SendInternalMessageA(WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message)); 1195 1196 return SendInternalMessageA(msg->message, msg->wParam, msg->lParam); 1193 SendMessageA(getWindowHandle(),WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message)); 1194 1195 switch(msg->message) 1196 { 1197 case WM_LBUTTONDOWN: 1198 case WM_MBUTTONDOWN: 1199 case WM_RBUTTONDOWN: 1200 { 1201 if (getParent()) 1202 { 1203 POINTS pt = MAKEPOINTS(msg->lParam); 1204 POINT point; 1205 1206 point.x = pt.x; 1207 point.y = pt.y; 1208 MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1); 1209 NotifyParent(msg->message, msg->wParam, MAKELPARAM(point.x,point.y)); 1210 } 1211 break; 1212 } 1213 } 1214 return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam); 1197 1215 } 1198 1216 //****************************************************************************** … … 1201 1219 { 1202 1220 if (select && IsWindowIconic()) 1203 return Send InternalMessageA(WM_PAINTICON, 1, 0);1221 return SendMessageA(getWindowHandle(),WM_PAINTICON, 1, 0); 1204 1222 else 1205 return Send InternalMessageA(WM_PAINT, 0, 0);1223 return SendMessageA(getWindowHandle(),WM_PAINT, 0, 0); 1206 1224 } 1207 1225 //****************************************************************************** … … 1218 1236 1219 1237 if(IsWindowIconic()) 1220 rc = Send InternalMessageA(WM_ICONERASEBKGND, hdcErase, 0);1238 rc = SendMessageA(getWindowHandle(),WM_ICONERASEBKGND, hdcErase, 0); 1221 1239 else 1222 rc = Send InternalMessageA(WM_ERASEBKGND, hdcErase, 0);1240 rc = SendMessageA(getWindowHandle(),WM_ERASEBKGND, hdcErase, 0); 1223 1241 if (hdc == 0) 1224 1242 ReleaseDC(getWindowHandle(), hdcErase); … … 1232 1250 //SDK: WM_SETCURSOR is not sent if the mouse is captured 1233 1251 if(GetCapture() == 0) { 1234 Send InternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, msg->message));1252 SendMessageA(getWindowHandle(),WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, msg->message)); 1235 1253 } 1236 1254 1237 1255 //translated message == WM_(NC)MOUSEMOVE 1238 return Send InternalMessageA(msg->message, msg->wParam, msg->lParam);1256 return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam); 1239 1257 } 1240 1258 //****************************************************************************** … … 1264 1282 hrgn = CreateRectRgnIndirect(pUpdateRect); 1265 1283 1266 rc = Send InternalMessageA(WM_NCPAINT, hrgn, 0);1284 rc = SendMessageA(getWindowHandle(),WM_NCPAINT, hrgn, 0); 1267 1285 1268 1286 DeleteObject(hrgn); … … 1355 1373 ULONG Win32BaseWindow::MsgSetText(LPSTR lpsz, LONG cch) 1356 1374 { 1357 return Send InternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);1375 return SendMessageA(getWindowHandle(),WM_SETTEXT, 0, (LPARAM)lpsz); 1358 1376 } 1359 1377 //****************************************************************************** … … 1361 1379 ULONG Win32BaseWindow::MsgGetTextLength() 1362 1380 { 1363 return Send InternalMessageA(WM_GETTEXTLENGTH, 0, 0);1381 return SendMessageA(getWindowHandle(),WM_GETTEXTLENGTH, 0, 0); 1364 1382 } 1365 1383 //****************************************************************************** … … 1367 1385 void Win32BaseWindow::MsgGetText(char *wndtext, ULONG textlength) 1368 1386 { 1369 Send InternalMessageA(WM_GETTEXT, textlength, (LPARAM)wndtext);1387 SendMessageA(getWindowHandle(),WM_GETTEXT, textlength, (LPARAM)wndtext); 1370 1388 } 1371 1389 //****************************************************************************** … … 1508 1526 */ 1509 1527 if ( uFlags & PRF_ERASEBKGND) 1510 Send InternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0);1528 SendMessageA(getWindowHandle(),WM_ERASEBKGND, (WPARAM)hdc, 0); 1511 1529 1512 1530 /* … … 1514 1532 */ 1515 1533 if ( uFlags & PRF_CLIENT) 1516 Send InternalMessageA(WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);1534 SendMessageA(getWindowHandle(),WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT); 1517 1535 1518 1536 … … 1644 1662 { 1645 1663 if(getParent()) { 1646 LRESULT rc = getParent()->SendInternalMessageA(WM_MOUSEACTIVATE, wParam, lParam );1664 LRESULT rc = SendMessageA(getParent()->getWindowHandle(), WM_MOUSEACTIVATE, wParam, lParam ); 1647 1665 if(rc) return rc; 1648 1666 } … … 1666 1684 { 1667 1685 if(getParent()) { 1668 LRESULT rc = getParent()->SendInternalMessageA(WM_SETCURSOR, wParam, lParam);1686 LRESULT rc = SendMessageA(getParent()->getWindowHandle(), WM_SETCURSOR, wParam, lParam); 1669 1687 if(rc) return rc; 1670 1688 } … … 1725 1743 if (!(wpos->flags & SWP_NOMOVE) && !(wpos->flags & SWP_NOCLIENTMOVE)) 1726 1744 { 1727 Send InternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left,rectClient.top));1745 SendMessageA(getWindowHandle(),WM_MOVE, 0, MAKELONG(rectClient.left,rectClient.top)); 1728 1746 } 1729 1747 if (!(wpos->flags & SWP_NOSIZE) && !(wpos->flags & SWP_NOCLIENTSIZE)) … … 1733 1751 if (dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED; 1734 1752 1735 Send InternalMessageA(WM_SIZE, wp, MAKELONG(rectClient.right - rectClient.left,1753 SendMessageA(getWindowHandle(),WM_SIZE, wp, MAKELONG(rectClient.right - rectClient.left, 1736 1754 rectClient.bottom - rectClient.top)); 1737 1755 } … … 1872 1890 else 1873 1891 if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000)) 1874 SendMessageW( WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE );1892 SendMessageW(getWindowHandle(), WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE ); 1875 1893 1876 1894 Win32BaseWindow *siblingWindow; … … 1904 1922 // key matches siblings mnemonic, send mouseclick 1905 1923 if (mnemonic == (char) wParam) { 1906 siblingWindow->SendInternalMessageA (BM_CLICK, 0, 0);1924 ::SendMessageA(siblingWindow->getWindowHandle(), BM_CLICK, 0, 0); 1907 1925 } 1908 1926 sibling = siblingWindow->GetNextWindow (GW_HWNDNEXT); … … 1938 1956 ::SendMessageW(GetParent(), Msg, wParam, lParam ); 1939 1957 } 1940 else SendMessageA(WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );1958 else ::SendMessageA(getWindowHandle(), WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam ); 1941 1959 } 1942 1960 #if 0 … … 1956 1974 case WM_CONTEXTMENU: 1957 1975 if ((dwStyle & WS_CHILD) && getParent()) 1958 getParent()->SendInternalMessageA(WM_CONTEXTMENU,wParam,lParam);1976 SendMessageA(getParent()->getWindowHandle(), WM_CONTEXTMENU,wParam,lParam); 1959 1977 return 0; 1960 1978 … … 2029 2047 2030 2048 case WM_HELP: 2031 if (getParent()) getParent()->SendInternalMessageA(Msg,wParam,lParam);2049 if (getParent()) SendMessageA(getParent()->getWindowHandle(), Msg,wParam,lParam); 2032 2050 break; 2033 2051 … … 2121 2139 //****************************************************************************** 2122 2140 //****************************************************************************** 2123 LRESULT Win32BaseWindow::SendMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)2124 {2125 //if the destination window is created by this process & thread, call window proc directly2126 if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {2127 return SendInternalMessageA(Msg, wParam, lParam);2128 }2129 //otherwise use WinSendMsg to send it to the right process/thread2130 dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));2131 return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);2132 }2133 //******************************************************************************2134 //******************************************************************************2135 LRESULT Win32BaseWindow::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)2136 {2137 //if the destination window is created by this process & thread, call window proc directly2138 if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {2139 return SendInternalMessageW(Msg, wParam, lParam);2140 }2141 //otherwise use WinSendMsg to send it to the right process/thread2142 return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, TRUE);2143 }2144 //******************************************************************************2145 //Called as a result of an OS/2 message or called from a class method2146 //******************************************************************************2147 LRESULT Win32BaseWindow::SendInternalMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)2148 {2149 LRESULT rc;2150 HWND hwnd = getWindowHandle();2151 BOOL fInternalMsgBackup = fInternalMsg;2152 2153 //if the destination window was created by this process & thread, call window proc directly2154 if(dwProcessId != currentProcessId || dwThreadId != GetCurrentThreadId()) {2155 dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));2156 return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);2157 }2158 2159 DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, FALSE, TRUE);2160 2161 CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, FALSE);2162 2163 fInternalMsg = TRUE;2164 switch(Msg)2165 {2166 case WM_CREATE:2167 {2168 if(CallWindowProcA(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {2169 dprintf(("WM_CREATE returned -1\n"));2170 rc = -1; //don't create window2171 break;2172 }2173 rc = 0;2174 break;2175 }2176 case WM_LBUTTONDOWN:2177 case WM_MBUTTONDOWN:2178 case WM_RBUTTONDOWN:2179 {2180 if (getParent())2181 {2182 POINTS pt = MAKEPOINTS(lParam);2183 POINT point;2184 2185 point.x = pt.x;2186 point.y = pt.y;2187 MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);2188 NotifyParent(Msg,wParam,MAKELPARAM(point.x,point.y));2189 }2190 rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);2191 break;2192 }2193 case WM_NCHITTEST:2194 rc = lastHitTestVal = win32wndproc(getWindowHandle(), WM_NCHITTEST, wParam, lParam);2195 break;2196 2197 case WM_DESTROY:2198 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);2199 break;2200 2201 default:2202 rc = CallWindowProcA(win32wndproc, getWindowHandle(), Msg, wParam, lParam);2203 break;2204 }2205 if(!::IsWindow(hwnd)) {2206 //window might have been destroyed by now. (this pointer invalid)2207 //we must return immediately2208 //(MS Visual C++ install heap corruption)2209 //TODO: could happen in several places here!!!!2210 return rc;2211 }2212 fInternalMsg = fInternalMsgBackup;2213 dprintf2(("SendMessageA %x %x %x %x returned %x", getWindowHandle(), Msg, wParam, lParam, rc));2214 return rc;2215 }2216 //******************************************************************************2217 //Called as a result of an OS/2 message or called from a class method2218 //******************************************************************************2219 LRESULT Win32BaseWindow::SendInternalMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)2220 {2221 LRESULT rc;2222 HWND hwnd = getWindowHandle();2223 BOOL fInternalMsgBackup = fInternalMsg;2224 2225 //if the destination window was created by this process & thread, call window proc directly2226 if(dwProcessId != currentProcessId || dwThreadId != GetCurrentThreadId()) {2227 dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));2228 return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);2229 }2230 2231 DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, TRUE, TRUE);2232 2233 CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, TRUE);2234 2235 fInternalMsg = TRUE;2236 switch(Msg)2237 {2238 case WM_CREATE:2239 {2240 if(CallWindowProcW(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {2241 dprintf(("WM_CREATE returned -1\n"));2242 rc = -1; //don't create window2243 break;2244 }2245 rc = 0;2246 break;2247 }2248 case WM_LBUTTONDOWN:2249 case WM_MBUTTONDOWN:2250 case WM_RBUTTONDOWN:2251 NotifyParent(Msg, wParam, lParam);2252 rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);2253 break;2254 2255 case WM_NCHITTEST:2256 rc = lastHitTestVal = win32wndproc(getWindowHandle(), WM_NCHITTEST, wParam, lParam);2257 break;2258 2259 case WM_DESTROY:2260 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);2261 break;2262 default:2263 rc = CallWindowProcW(win32wndproc, getWindowHandle(), Msg, wParam, lParam);2264 break;2265 }2266 if(!::IsWindow(hwnd)) {2267 //window might have been destroyed by now. (this pointer invalid)2268 //we must return immediately2269 //(MS Visual C++ install heap corruption)2270 //TODO: could happen in several places here!!!!2271 return rc;2272 }2273 fInternalMsg = fInternalMsgBackup;2274 dprintf2(("SendMessageW %x %x %x %x returned %x", getWindowHandle(), Msg, wParam, lParam, rc));2275 return rc;2276 }2277 //******************************************************************************2278 //******************************************************************************2279 void Win32BaseWindow::CallWindowHookProc(ULONG hooktype, ULONG Msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode)2280 {2281 CWPSTRUCT cwp;2282 2283 cwp.lParam = lParam;2284 cwp.wParam = wParam;2285 cwp.message = Msg;2286 cwp.hwnd = getWindowHandle();2287 2288 switch(hooktype) {2289 case WH_CALLWNDPROC:2290 if(fUnicode) {2291 HOOK_CallHooksW(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);2292 }2293 else HOOK_CallHooksA(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);2294 break;2295 }2296 }2297 //******************************************************************************2298 //TODO: Do this more efficiently2299 //******************************************************************************2300 LRESULT Win32BaseWindow::BroadcastMessageA(int type, UINT msg, WPARAM wParam, LPARAM lParam)2301 {2302 Win32BaseWindow *window;2303 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;2304 2305 dprintf(("BroadCastMessageA %x %x %x %s", msg, wParam, lParam, (type == BROADCAST_SEND) ? "Send" : "Post"));2306 2307 for(int i=0;i<MAX_WINDOW_HANDLES;i++) {2308 window = GetWindowFromHandle(hwnd++);2309 if(window) {2310 if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))2311 {2312 if(type == BROADCAST_SEND) {2313 ::SendMessageA(window->getWindowHandle(), msg, wParam, lParam);2314 }2315 else PostMessageA(window->getWindowHandle(), msg, wParam, lParam);2316 }2317 RELEASE_WNDOBJ(window);2318 }2319 }2320 return 0;2321 }2322 //******************************************************************************2323 //TODO: Do this more efficiently2324 //******************************************************************************2325 LRESULT Win32BaseWindow::BroadcastMessageW(int type, UINT msg, WPARAM wParam, LPARAM lParam)2326 {2327 Win32BaseWindow *window;2328 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;2329 2330 dprintf(("BroadCastMessageW %x %x %x %s", msg, wParam, lParam, (type == BROADCAST_SEND) ? "Send" : "Post"));2331 2332 for(int i=0;i<MAX_WINDOW_HANDLES;i++) {2333 window = GetWindowFromHandle(hwnd++);2334 if(window) {2335 if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))2336 {2337 if(type == BROADCAST_SEND) {2338 ::SendMessageW(window->getWindowHandle(), msg, wParam, lParam);2339 }2340 else PostMessageW(window->getWindowHandle(), msg, wParam, lParam);2341 }2342 RELEASE_WNDOBJ(window);2343 }2344 }2345 return 0;2346 }2347 //******************************************************************************2348 //******************************************************************************2349 2141 void Win32BaseWindow::NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam) 2350 2142 { … … 2359 2151 parentwindow = window->getParent(); 2360 2152 if(parentwindow) { 2361 parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam );2153 SendMessageA(parentwindow->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam ); 2362 2154 } 2363 2155 } … … 2491 2283 if (showFlag != wasVisible) 2492 2284 { 2493 Send InternalMessageA(WM_SHOWWINDOW, showFlag, 0 );2285 SendMessageA(getWindowHandle(),WM_SHOWWINDOW, showFlag, 0 ); 2494 2286 if (!::IsWindow( getWindowHandle() )) goto END; 2495 2287 } … … 2517 2309 wParam = SIZE_MINIMIZED; 2518 2310 2519 Send InternalMessageA(WM_SIZE, wParam,2311 SendMessageA(getWindowHandle(),WM_SIZE, wParam, 2520 2312 MAKELONG(rectClient.right-rectClient.left, 2521 2313 rectClient.bottom-rectClient.top)); 2522 Send InternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));2314 SendMessageA(getWindowHandle(),WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top)); 2523 2315 } 2524 2316 //testestest … … 2721 2513 rectWindow.top += dy; 2722 2514 rectWindow.bottom += dy; 2723 Send InternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));2515 SendMessageA(getWindowHandle(),WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top)); 2724 2516 return TRUE; 2725 2517 } … … 2751 2543 WINDOWPOS wpOld = *wpos; 2752 2544 if(!(wpos->flags & SWP_NOSENDCHANGING)) 2753 Send InternalMessageA(WM_WINDOWPOSCHANGING, 0, (LPARAM)wpos);2545 SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGING, 0, (LPARAM)wpos); 2754 2546 2755 2547 if ((wpos->hwndInsertAfter != wpOld.hwndInsertAfter) || … … 2759 2551 SetWindowPos(wpos->hwndInsertAfter, wpos->x, wpos->y, wpos->cx, wpos->cy, wpos->flags | SWP_NOSENDCHANGING); 2760 2552 } 2761 else Send InternalMessageA(WM_WINDOWPOSCHANGED, 0, (LPARAM)wpos);2553 else SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGED, 0, (LPARAM)wpos); 2762 2554 2763 2555 //Calculate invalid areas … … 2882 2674 { 2883 2675 /* Notify the parent window only */ 2884 getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());2676 SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle()); 2885 2677 if(!::IsWindow(hwnd) ) 2886 2678 { … … 2906 2698 if (NULL != owner) 2907 2699 { 2908 if (owner->getLastActive() == hwnd)2909 owner->setLastActive( owner->getWindowHandle() );2700 if (owner->getLastActive() == hwnd) 2701 owner->setLastActive( owner->getWindowHandle() ); 2910 2702 } 2911 2703 … … 3096 2888 //****************************************************************************** 3097 2889 //TODO: Should not enumerate children that are created during the enumeration! 2890 //TODO: Do this more efficiently 3098 2891 //****************************************************************************** 3099 2892 BOOL Win32BaseWindow::EnumChildWindows(WNDENUMPROC lpfn, LPARAM lParam) … … 3176 2969 BOOL Win32BaseWindow::EnumWindows(WNDENUMPROC lpfn, LPARAM lParam) 3177 2970 { 3178 Win32BaseWindow * child = 0;3179 BOOL rc;3180 HWND hwnd;2971 Win32BaseWindow *window; 2972 BOOL rc; 2973 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD; 3181 2974 3182 2975 dprintf(("EnumWindows %x %x", lpfn, lParam)); 3183 2976 3184 for (child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild()) 3185 { 3186 hwnd = child->getWindowHandle(); 3187 3188 dprintf2(("EnumWindows: Found Window %x", child->getWindowHandle())); 3189 if((rc = lpfn(child->getWindowHandle(), lParam)) == FALSE) { 3190 break; 3191 } 3192 } 2977 for(int i=0;i<MAX_WINDOW_HANDLES;i++) 2978 { 2979 window = GetWindowFromHandle(hwnd++); 2980 if(window) 2981 { 2982 if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION)) 2983 { 2984 dprintf2(("EnumWindows: Found Window %x", window->getWindowHandle())); 2985 if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE) { 2986 break; 2987 } 2988 } 2989 RELEASE_WNDOBJ(window); 2990 } 2991 } 2992 if(window) RELEASE_WNDOBJ(window); 3193 2993 return TRUE; 3194 2994 } … … 3523 3323 rc = (getStyle() & WS_DISABLED) != 0; 3524 3324 if(rc && !fEnable) { 3525 SendMessageA( WM_CANCELMODE, 0, 0);3325 SendMessageA(getWindowHandle(), WM_CANCELMODE, 0, 0); 3526 3326 } 3527 3327 OSLibWinEnableWindow(OS2HwndFrame, fEnable); … … 3624 3424 { 3625 3425 //if the destination window is created by this process, send message 3626 if(dwProcessId == currentProcessId) { 3426 if(dwProcessId == currentProcessId) 3427 { 3627 3428 if(fUnicode) { 3628 return Send InternalMessageW(WM_GETTEXTLENGTH,0,0);3629 } 3630 else return Send InternalMessageA(WM_GETTEXTLENGTH,0,0);3429 return SendMessageW(getWindowHandle(), WM_GETTEXTLENGTH,0,0); 3430 } 3431 else return SendMessageA(getWindowHandle(), WM_GETTEXTLENGTH,0,0); 3631 3432 } 3632 3433 //else get data directory from window structure … … 3642 3443 //if the destination window is created by this process, send message 3643 3444 if(dwProcessId == currentProcessId) { 3644 return Send InternalMessageA(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);3445 return SendMessageA(getWindowHandle(),WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz); 3645 3446 } 3646 3447 … … 3659 3460 //if the destination window is created by this process, send message 3660 3461 if(dwProcessId == currentProcessId) { 3661 return SendInternalMessageW(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);3462 return ::SendMessageW(getWindowHandle(), WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz); 3662 3463 } 3663 3464 //else get data directory from window structure 3664 if (!lpsz || !cch)3665 return 0;3666 if (!windowNameW)3667 lpsz[0] = 0;3668 else3669 memcpy(lpsz, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), cch));3465 if (!lpsz || !cch) 3466 return 0; 3467 if (!windowNameW) 3468 lpsz[0] = 0; 3469 else 3470 memcpy(lpsz, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), cch)); 3670 3471 3671 return min(windowNameLength, cch);3472 return min(windowNameLength, cch); 3672 3473 } 3673 3474 //****************************************************************************** … … 3676 3477 BOOL Win32BaseWindow::SetWindowTextA(LPSTR lpsz) 3677 3478 { 3678 return Send InternalMessageA(WM_SETTEXT,0,(LPARAM)lpsz);3479 return SendMessageA(getWindowHandle(),WM_SETTEXT,0,(LPARAM)lpsz); 3679 3480 } 3680 3481 //****************************************************************************** … … 3682 3483 BOOL Win32BaseWindow::SetWindowTextW(LPWSTR lpsz) 3683 3484 { 3684 return Send InternalMessageW(WM_SETTEXT,0,(LPARAM)lpsz);3485 return SendMessageW(getWindowHandle(), WM_SETTEXT,0,(LPARAM)lpsz); 3685 3486 } 3686 3487 //****************************************************************************** … … 3702 3503 ss.styleNew = value; 3703 3504 dprintf(("SetWindowLong GWL_EXSTYLE %x old %x new style %x", getWindowHandle(), dwExStyle, value)); 3704 Send InternalMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);3505 SendMessageA(getWindowHandle(),WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss); 3705 3506 setExStyle(ss.styleNew); 3706 Send InternalMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);3507 SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss); 3707 3508 oldval = ss.styleOld; 3708 3509 break; … … 3727 3528 ss.styleOld = getStyle(); 3728 3529 ss.styleNew = value | (ss.styleOld & WS_CHILD); 3729 Send InternalMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);3530 SendMessageA(getWindowHandle(),WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss); 3730 3531 setStyle(ss.styleNew); 3731 Send InternalMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);3532 SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss); 3732 3533 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), getStyle(), getExStyle()); 3733 3534
Note:
See TracChangeset
for help on using the changeset viewer.