Advertisement
Guest User

set window resolution

a guest
Mar 13th, 2016
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Windows.h>
  2.  
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.     wchar_t window_name[128] = { 0 };
  8.     HWND window_handle = 0;
  9.     int window_x = 0;
  10.     int window_y = 0;
  11.  
  12.     while (!window_handle)
  13.     {
  14.         wprintf(L"enter window name: ");
  15.         wscanf(L"%s", window_name);
  16.  
  17.         window_handle = FindWindow(NULL, window_name);
  18.  
  19.         if (window_handle)
  20.         {
  21.             wprintf(L"window found.\n\n");
  22.         }
  23.         else
  24.         {
  25.             wprintf(L"could not find window.\n\n");
  26.         }
  27.     }
  28.  
  29.     wprintf(L"enter window x: ");
  30.     wscanf(L"%d", &window_x);
  31.  
  32.     wprintf(L"enter window y: ");
  33.     wscanf(L"%d", &window_y);
  34.  
  35.     SetWindowPos(window_handle, NULL, 0, 0, window_x, window_y, NULL);
  36.     wprintf(L"window resolution changed.\n\n");
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement