开发者

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 u开发者_StackOverflow中文版ser 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);


If you have the HWND (obtainable through FindWindow or FindWindowEx), you can use SetWindowPos / MoveWindow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜