using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
namespace InGameOverlay
{
public partial class Form1 : Form
{
IntPtr Game;
Graphics GameOverlay;
Thread GameOverLayThread;
[DllImport( "user32.dll" )]
public static extern IntPtr FindWindow(
string lpClassName, // pouinter to class name
string lpWindowName // pouinter to window name
);
public Form1() {
InitializeComponent();
Game = FindWindow( null, "Counter-Strike" );
GameOverlay = Graphics.FromHwnd( Game );
}
public void DrawTime() {
String Text = "00:12:32 PM";
Font Verdana = new Font( "Verdana", 7, FontStyle.Bold );
SolidBrush BrushGold = new SolidBrush( Color.Gold );
SolidBrush BrushBlack = new SolidBrush( Color.Black );
PointF FrontPoint = new PointF( 29.0F, 120.0F );
PointF BehindPoint = new PointF( 30.0F, 121.0F );
GameOverlay.DrawString( Text, Verdana, BrushBlack, BehindPoint );
GameOverlay.DrawString( Text, Verdana, BrushGold, FrontPoint );
GameOverlay.Dispose();
}
private void button1_Click( object sender, EventArgs e ) {
GameOverLayThread = new Thread( DrawTime );
GameOverLayThread.Start();
}
}
}