日期:2014-05-17 浏览次数:20874 次
private void button1_Clicked(object sender, EventArgs e)
{
var visualStudio = Process.GetProcessesByName("devenv").FirstOrDefault();
Rectangle rect = new Rectangle();
if (visualStudio != null && GetWindowRect(visualStudio.MainWindowHandle, ref rect))
{
MessageBox.Show("visual studio @" + rect);
}
}
[DllImport("User32")]
static extern bool GetWindowRect(IntPtr hWnd, ref Rectangle rect);