I'm working on a project. I am writing a program in Windows 10+Visual Studio 2019. In my C# program, I want to move the position of the Explorer window that is displayed on the screen. For example, let's say I have a folder named C:\Users\username\Documents\datawindow open. The screen position is X=100, Y=100. How can I move the position of this window to X=500, Y=500?
In the code below, I have found the Process that contains datawindow. I want to change the window position of this process from my C# program. Please give me your best advice.
public class WindowLocation : Form
{
public void SetExplorerWindowLocation()
{
foreach (Process p in Process.GetProcesses().Where(process => process.ProcessName=="explorer"))
{
Console.WriteLine("ProcessName:" + p.ProcessName);
Console.WriteLine("WindowTitle:" + p.MainWindowTitle);
}
}
}