I have figured out how to move windowses, multiple of them, but I have this problem where all of them overlap each other, like this:
But I want it to be like this:
I also tried doing a single instance of notepad but I couldn't figure out.
using System;
using System.Diagnostics;
using System.Windows.Forms;
using WindowScrape.Types;
namespace test
{
public partial class Form1 : Form
{
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
private void Form1_Load(object sender, EventArgs e)
{
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
uint SWP_NOSIZE = 0x0001;
foreach (Process process in Process.GetProcessesByName("notepad"))
{
var lol = HwndObject.GetWindowByTitle(process.MainWindowTitle);
var x = lol.Location.X;
var y = lol.Location.Y;
SetWindowPos(process.MainWindowHandle, 0, x + rnd.Next(0, 1), y + rnd.Next(0, 1), 0, 0, SWP_NOSIZE);
}
}
}
}