Go To Post
Ich find Knackers tuts spitze. Allerdings bin ich fan von managed code, daher ist das .net framework in der regel meine erste wahl. Ausserdem will ich ja propagieren, dass man selbst mit managed code einiges auf die beine bekommt :-D Ich persönlich verwendet c#, lässt sich allerdings auch in vb.net etc realisieren...
Schritt 1:
Welche WinApi Funktionen brauchen wir? Steht alles in Knackers tut
Schritt 2:
unseren .net code interop fähig machen
TEXT Code:
using System.Runtime.InteropServices;
http://msdn.microsoft.com/de-de/library/system.runtime.interopservices.aspx
Schritt 3:
Wir nehmen die WinApi - Funktionen und machen Sie mit Hilfe der InteropServices, im speziellen der DllImportAttribute - Klasse für uns verwendbar.
Für Tut 9 sieht das dann in etwa so aus:
TEXT Code:
[DllImport("user32.dll")]
static extern int GetForegroundWindow();
[DllImport("user32.dll")]
static extern int GetDC(int foreground);
[DllImport("Gdi32.dll")]
static extern int SetBkMode(int hdc, string mode);
[DllImport("Gdi32.dll")]
static extern int SetTextColor(int hdc, string rgb);
[DllImport("Gdi32.dll")]
static extern int TextOut(int hdc, int xStart, int yStart, string lpString, int cbString);
[DllImport("user32.dll")]
static extern int UpdateWindow(int foreground);
[DllImport("user32.dll")]
static extern int ReleaseDC(int foreground, int hdc);
Schritt 4:
Den Klimbatsch kann man nun in ne Methode wurschteln:
TEXT Code:
int foreground = GetForegroundWindow();
int hdc = GetDC(foreground);
SetBkMode(hdc, "TRANSPARENT");
SetTextColor(hdc, "RGB(255,0,0)");
TextOut(hdc, 10, 10, "bla", 3);
UpdateWindow(foreground);
ReleaseDC(foreground, hdc);
System.Threading.Thread.Sleep(1);
Ta ta ta taaa...wenn man jetzt net so faul ist wie ich kann weiter machen
Nu jo, over and out