简体   繁体   中英

Moving the location and changing size of a external program

By the term of external program, it refer to programs not developed by me.

I have 2 program that needs to be launch together, 1 of it is program developed by me, another is for instance, Window Media Player (just for example only).

These programs will be placed in a static position with no user interaction, so I need to configure their height width and their x/y coordinates. No issue for my own program, but for external program, will I be able to use window message to change their size as well as location.

I have never worked with window message before but I read up somewhere about sendMessage(), but I not sure of the command to move and resize.

My program is done in C#, and I hope to be able to do something like that

You can use the MoveWindow API

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

MoveWindow(ApplicationHandle, 600, 600, 600, 600, True);

如果您拥有HWND (可通过FindWindowFindWindowEx获得),则可以使用SetWindowPos / MoveWindow

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