Пример #1
0
 // 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;
 }
Пример #2
0
  // 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);
  }
Пример #3
0
 // 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;
 }
Пример #4
0
 // 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;
 }
Пример #5
0
 // 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;
 }
Пример #6
0
 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);
   }
 }
Пример #7
0
 // 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;
 }
Пример #8
0
 // 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;
 }
Пример #9
0
 // BOOL UpdateWindow(HWND hWnd)
 public static int UpdateWindow(int hWnd) {
   WinWindow window = WinWindow.get(hWnd);
   if (window == null) return FALSE;
   updateWindow(window);
   return TRUE;
 }