Advertisement
Guest User

main.cpp

a guest
Jun 1st, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. #include "stdafx.h"
  2.  
  3. BOOL CALLBACK find_and_resize_proc1(HWND hwnd, LPARAM lParam)
  4. {
  5.     WCHAR wsz1[128];
  6.     WCHAR wsz2[128];
  7.     GetClassName(hwnd, wsz1, 128);
  8.     GetWindowText(hwnd, wsz2, 128);
  9.     if (wcscmp(wsz1, L"Chrome_WidgetWin_0") != 0 || !wsz2[0])
  10.         return TRUE;
  11.  
  12.     RECT rc, rc1, rc2;
  13.     GetClientRect(hwnd, &rc);
  14.     HWND hwnd1 = GetWindow(hwnd, GW_CHILD);
  15.     HWND hwnd2 = GetWindow(hwnd1, GW_HWNDNEXT);
  16.     hwnd2 = GetWindow(hwnd2, GW_HWNDNEXT);
  17.     GetWindowRect(hwnd1, &rc1);
  18.     GetWindowRect(hwnd2, &rc2);
  19.     MapWindowPoints(HWND_DESKTOP, hwnd, (LPPOINT)&rc1, 2);
  20.     MapWindowPoints(HWND_DESKTOP, hwnd, (LPPOINT)&rc2, 2);
  21.  
  22.     rc1.left += 100;
  23.     rc1.top += 100;
  24.     rc1.bottom -= 100;
  25.     rc1.right = rc.right / 2;
  26.  
  27.     MoveWindow(hwnd1, rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top, TRUE);
  28.     return FALSE;
  29. }
  30.  
  31. int APIENTRY _tWinMain(HINSTANCE hInstance,
  32.                      HINSTANCE hPrevInstance,
  33.                      LPTSTR    lpCmdLine,
  34.                      int       nCmdShow)
  35. {
  36.     EnumWindows(find_and_resize_proc2, NULL);
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement