API在Vista上无法正常运行

API在Vista上无法正常运行

本文介绍了MoveWindow API在Vista上无法正常运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!我在Vista上有一个应用程序,该应用程序遍历所有进程并找到相关的主窗口,以便移动和调整它们的大小.

问题在于某些窗口会移动并调整大小,而有些窗口则不会.甚至似乎移动和调整大小后的窗口都没有根据MoveWindow函数调用移动和调整大小,因为它们被调整为标题栏的大小并且它们都在同一行(相同的y坐标)上.

这是示例代码:

Hello! I have an application on Vista which loops through all processes and finds associated main windows in order to move and resize them.

The problem is that some windows get moved and resized and some don''t. Also it even seems that moved and resized windows aren''t moved and resized according to the MoveWindow function call because they are resized to title bar and all of them are on the same line (same y coordinate).

Here''s the sample code:

IntPtr handle;
Process[] processList = Process.GetProcesses();

int i = 0;
foreach (Process process in processList)
{
     handle = process.MainWindowHandle;

     if (handle != IntPtr.Zero)
     {
          MoveWindow(handle, i * 50, i * 50, 500, 500, true);
          i++;
     }
}


这是因为Vista吗?我应该使用什么替代方法?


Is this because of Vista? What alternative should I use?

推荐答案



这篇关于MoveWindow API在Vista上无法正常运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 18:25