2
저는 Windows 개발자가 아닙니다 (AS3 작업). Visual C# 2010에서이 C# 콘솔 응용 프로그램을 테스트하여 무언가를 테스트했습니다. 앱이 열린 창을 열고 크기를 조정하고 위치를 변경해야합니다.user32 MoveWindow는 C#, Windows 7, 콘솔 응용 프로그램에서 작동하지 않습니다.
빈 크롬 창 (제목 없음)을 열었지만 창을 제어하는 기능이 작동하지 않습니다 (디버거가 멈춘다해도 앱이 올바른 창을 찾았 음).
이유가 무엇입니까?
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hwnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
[DllImport("user32.dll")]
private static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
static void Main(string[] args)
{
Process[] processlist = Process.GetProcesses();
foreach (Process proc in processlist)
{
if (!String.IsNullOrEmpty(proc.MainWindowTitle) && proc.MainWindowTitle == "Untitled")
{
ShowWindow(proc.Handle, 3);
MoveWindow(proc.Handle, 0, 0, 100, 100, true);
}
}
}
}
}
thanx a many Hans! – Saariko