|
-
February 27th, 2008, 09:57 AM
#1
Drawing On Top Of Another Application
I just created an application to see if I were able to draw a string on top of another application (a game). Essentially it's going to be a parser that will show how much damage you do per second, by reading a log file.
What I'm currently doing is having a timer redraw it every so often, but problem is it flickers a lot. I remember when I created a screensaver I had to enable double buffering, to prevent it from flickering, but since I don't really have the same control over the application, I'm kinda stumped as to what to do. Here's the code I use to find window and draw on it:
Code:
Graphics eqGraphic;
Font font;
SolidBrush brush;
private void Form1_Load(object sender, EventArgs e)
{
Process[] ps = Process.GetProcesses();
Process eqProcess = null;
foreach (Process p in ps)
{
if (p.MainWindowTitle == "EQW beta 2.35a")
{
eqProcess = p;
break;
}
}
//listBox1.Items.Add(eqProcess.MainWindowHandle);
IntPtr ptr = eqProcess.MainWindowHandle;
eqGraphic = Graphics.FromHwnd(ptr);
font = new Font("Arial", 16);
brush = new SolidBrush(Color.Black);
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
eqGraphic.DrawString("HELLO", font, brush, new PointF(100, 100));
}
Sincerely,
Martin Svendsen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|