// BOOL RedrawWindow(HWND hWnd, const RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags) public static int RedrawWindow(int hWnd, int lprcUpdate, int hrgnUpdate, int flags) { log("RedrawWindow faked"); if (hWnd == 0) hWnd = WinWindow.GetDesktopWindow(); WinWindow window = WinWindow.get(hWnd); if (window == null) return FALSE; return TRUE; }
// HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps ) public static int BeginPaint(int hwnd, int lps) { WinWindow win = WinWindow.get(hwnd); if (lps == 0) return 0; Caret.HideCaret(hwnd); int rgn = WinRegion.CreateRectRgn(0, 0, win.rectWindow.width(), win.rectWindow.height()); Message.SendMessageA(hwnd, WM_NCPAINT, rgn, 0); GdiObj.DeleteObject(rgn); WinDC dc = win.getDC(); if (win.invalidationRect == null) { new WinRect(0, 0, win.rectClient.width(), win.rectClient.height()).write(lps + 8); } else { dc.clipX = win.invalidationRect.left; dc.clipY = win.invalidationRect.top; dc.clipCx = win.invalidationRect.width(); dc.clipCy = win.invalidationRect.height(); win.invalidationRect.write(lps + 8); } int hdc = dc.handle; writed(lps, hdc); writed(lps + 4, Message.SendMessageA(hwnd, WM_ERASEBKGND, hdc, 0)); return readd(lps); }
// HDC WINAPI GetDC(HWND hwnd) public static int GetDC(int hwnd) { WinWindow win; if (hwnd == 0) { win = WinWindow.get(StaticData.desktopWindow); } else win = WinWindow.get(hwnd); if (win == null) return 0; WinDC dc = win.getDC(); dc.open(); return dc.handle; }
// BOOL InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase) public static int InvalidateRect(int hWnd, int lpRect, int bErase) { WinWindow window = WinWindow.get(hWnd); if (window == null) return FALSE; // :TODO: invalidate all windows WinRect rect = null; if (lpRect != 0) { rect = new WinRect(lpRect); } window.invalidate(rect); return TRUE; }
public void checkWinWindow(Boolean win) { // if the user did not win then an error will be thrown by a window if (!win) { ErrorWindow ew = new ErrorWindow("Not Win", null, 0); ew.setVisible(true); time.start(); } // if user did win then a new "WinWindow" will pop up else { WinWindow ww = new WinWindow(timeCount, counterPress, getLevel); ww.setVisible(true); } }
// BOOL EndPaint(HWND hWnd, const PAINTSTRUCT *lpPaint) public static int EndPaint(int hWnd, int lpPaint) { WinDC dc = WinDC.get(readd(lpPaint)); if (dc != null) dc.close(); Caret.ShowCaret(hWnd); Main.drawImage(StaticData.screen.getImage()); WinWindow.get(hWnd).validate(); return TRUE; }
private static void updateWindow(WinWindow window) { Message.SendMessageA(window.handle, WM_PAINT, 0, 0); Iterator<WinWindow> children = window.getChildren(); while (children.hasNext()) { WinWindow child = children.next(); updateWindow(child); } }
// int GetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase) public static int GetUpdateRgn(int hWnd, int hRgn, int bErase) { WinWindow win = WinWindow.get(hWnd); WinRegion rgn = WinRegion.get(hRgn); if (win == null || rgn == null) return ERROR; if (win.needsPainting()) { if (bErase != 0) { rgn.rects.clear(); rgn.rects.add(new WinRect(0, 0, win.rectWindow.width(), win.rectWindow.height())); Message.SendMessageA(hWnd, WM_NCPAINT, hRgn, 0); int hdc = win.getDC().handle; Message.SendMessageA(hWnd, WM_ERASEBKGND, hdc, 0); ReleaseDC(hWnd, hdc); } rgn.rects.clear(); rgn.rects.add(new WinRect(0, 0, win.rectClient.width(), win.rectClient.height())); return SIMPLEREGION; } return NULLREGION; }
// BOOL ValidateRect(HWND hWnd, const RECT *lpRect) public static int ValidateRect(int hWnd, int lpRect) { if (hWnd == 0) updateWindow(WinWindow.get(StaticData.desktopWindow)); return TRUE; }
// BOOL UpdateWindow(HWND hWnd) public static int UpdateWindow(int hWnd) { WinWindow window = WinWindow.get(hWnd); if (window == null) return FALSE; updateWindow(window); return TRUE; }