简体   繁体   中英

Move or resize the windows of 3rd party programs with c#

We have a C# base frame program here in the company, it is able to run C# codes. When it starts, it runs in full screen mode, besides we have more program that runs in parallel.

I would like to put our program to the left side, another program to the right side on the screen at startup.

How can I move or resize 3rd party program windows in C#?

You can do it with MoveWindow WinAPI function:

//Import:
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);

//Usage:
MoveWindow(ApplicationHandle, 600, 600, 600, 600, True);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM