sbondo1234
Member
- Joined
- Jan 21, 2020
- Messages
- 8
- Programming Experience
- 1-3
<div class="bbWrapper">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.<br />
<br />
Is it possible to draw graphics over a different processes window that is interactable?<br />
<br />
When I say interactable I mainly mean that the user is able to move the window around by using the drawn graphics.<br />
<br />
<b>Edit (Found some code that kind of helps):</b><br />
<br />
This code keeps drawing a box onto the desktop:<br />
<br />
<div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code language-csharp "
data-xf-init="CMTV-code-block">
<div class="bbCodeBlock-header">
<div class="bbCodeBlock-title">
<span title="">
C#:
</span>
</div>
<div class="bbCodeBlock-actions">
<i class="fa--xf far fa-expand-alt action action--expand action--hidden"><svg xmlns="http://www.w3.org/2000/svg" role="img" data-xf-init="tooltip" data-xf-click="CMTV-code-block-expand"><title>Expand</title><use href="/data/local/icons/regular.svg?v=1757593269#expand-alt"></use></svg></i>
<i class="fa--xf far fa-compress-alt action action--collapse action--hidden"><svg xmlns="http://www.w3.org/2000/svg" role="img" data-xf-init="tooltip" data-xf-click="CMTV-code-block-collapse"><title>Collapse</title><use href="/data/local/icons/regular.svg?v=1757593269#compress-alt"></use></svg></i>
<i class="fa--xf far fa-paste action action--copy"><svg xmlns="http://www.w3.org/2000/svg" role="img" data-xf-init="tooltip"><title>Copy</title><use href="/data/local/icons/regular.svg?v=1757593269#paste"></use></svg></i>
</div>
</div>
<div class="bbCodeBlock-content" dir="ltr">
<pre class="bbCodeCode line-numbers" dir="ltr" data-line="" data-xf-init="CMTV-code-block-extend" data-lang="csharp"><code>[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);
}</code></pre>
</div>
<div class="bbCodeBlock-grip resizer--hidden" data-xf-init="CMTV-code-block-resizer">
<i class="fa--xf far fa-grip-horizontal "><svg xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true" ><use href="/data/local/icons/regular.svg?v=1757593269#grip-horizontal"></use></svg></i>
</div>
</div><br />
Is there a way to make it draw over a window, instead of just directly onto the desktop?<br />
<br />
More importantly, is there a way to check if the user click/drags on the graphic and then call another function when that happens?</div>
Last edited: