How can i resize a specific window after it's created?

Newbie picture Newbie · Dec 24, 2010 · Viewed 8.5k times · Source

I want to resize some game window (DirectX) after it has been created, the game window allows resizing by mouse from the edges. But i want to automate this because it's quite hard to do this by mouse: cursor is invisible at the edges and i must de-focus the window first to be able to resize by clicking at the edges. To be clear: i have no sources for this game, so i must make my own program to do this.

How can this be done? Or better: is there already existing programs to do these things?

Answer

yurymik picture yurymik · Dec 24, 2010

There might be problems, but its better to try simple things first.

As your post tagged with C++ I suppose you're looking for WinAPI solution. Try this one:


int width = 640;
int height = 480;

HWND handle = ::FindWindow(NULL, _T("Window title"));

::SetWindowPos(handle, 0, 0, 0, width, height, SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);