1

I'm looking to do a graphical overlay to display some data that will be on top of any window, even full screen applications.

I can use the API hook to get the active window, which will allow me to create a graphics object and draw on top of the active window which is almost what i'm looking for. The only issue is that when I try to use a drawstring call it uses that window's bounds to draw the data out.

So the call:

gphx.DrawString("test", New Font("Tahoma", 12), New SolidBrush(Color.Red), New PointF(0, 0))

Would display "test" in the top left corner of the form's usable area, not even in the title bar. You can't even use negative numbers in that call, because it utilized the forms usable area as the canvas, so you end up just drawing to an area that isn't visible.

My goal is to have the data always display in the same spot of a screen, regardless of where a window is located.

API Hook Used to get the active window.

<Runtime.InteropServices.DllImport("user32.dll")>
    Public Function GetForegroundWindow() As IntPtr
    End Function

Is there a function to either get the handle of a screen (I seriously doubt) or a way to draw to the screen directly?

I would prefer to not have to get into using a DirectX library to accomplish this, but if its not possible with GDI+ or through some other API calls, I'll have to go that route.

jblaske
  • 691
  • 1
  • 5
  • 19
  • 1
    http://stackoverflow.com/questions/2905783/how-to-effectively-draw-on-desktop-in-c – agent-j May 01 '12 at 17:06
  • Unfortunately this doesn't actually solve my problem, any time a full screen application is up, the overlay is no longer shown. – jblaske May 02 '12 at 01:50

0 Answers0