sbondo1234
Member
- Joined
- Jan 21, 2020
- Messages
- 8
- Programming Experience
- 1-3
My main goal is to be able to move a window that doesn't have borders, the window is for a different process that wasn't made with the same c# script. If this is the wrong way to go about it please tell.
Is it possible to draw graphics over a different processes window that is interactable?
When I say interactable I mainly mean that the user is able to move the window around by using the drawn graphics.
Edit (Found some code that kind of helps):
This code keeps drawing a box onto the desktop:
Is there a way to make it draw over a window, instead of just directly onto the desktop?
More importantly, is there a way to check if the user click/drags on the graphic and then call another function when that happens?
Is it possible to draw graphics over a different processes window that is interactable?
When I say interactable I mainly mean that the user is able to move the window around by using the drawn graphics.
Edit (Found some code that kind of helps):
This code keeps drawing a box onto the desktop:
C#:
[DllImport("User32.dll")]
public static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("User32.dll")]
public static extern void ReleaseDC(IntPtr hwnd, IntPtr dc);
while (true)
{
IntPtr desktopPtr = GetDC(IntPtr.Zero);
Graphics g = Graphics.FromHdc(desktopPtr);
SolidBrush b = new SolidBrush(Color.Red);
g.FillRectangle(b, new Rectangle(0, 0, 192, 108));
g.Dispose();
ReleaseDC(IntPtr.Zero, desktopPtr);
}
Is there a way to make it draw over a window, instead of just directly onto the desktop?
More importantly, is there a way to check if the user click/drags on the graphic and then call another function when that happens?
Last edited: