S
HI,
ich versuch schon seit längeren ein Crosshair zu programmieren (ein kleines Kreuz in der Mitte des Bilschirms als Zielhilfe), dass Programm funktioniert schon gut aber noch nicht perfekt ;). Wenn ich das Programm starte zeichnet is mir schon mein Crosshair auf dem Bildschirm (bin noch !nicht! im Spiel), aber sobald ich das Spiel starte ist es nicht sichtbar und nach längerer Zeit ändert es seine Farbe (nicht im Spiel, da es dort nicht sichtbar ist) auf dem Bildschirm zu schwarz (Default) dabei soll es grün bleiben. Wie könnte man das Problem beheben? Es soll im Spiel sichtbar sein und seine Farbe nicht mehr ändern! Danke für die Antworten
Das hab ich bisher schon:
#include <main-header.h>
bool cross1 = false;
HWND foreground = NULL;
HDC hdc = NULL;
int x = GetSystemMetrics(SM_CXSCREEN) / 2;
int y = GetSystemMetrics(SM_CYSCREEN) / 2;
int WINAPI WinMain (HINSTANCE ,HINSTANCE ,LPSTR , int)
{
while(1)
{
if (GetAsyncKeyState(VK_NUMPAD1) & (1 == 1))
{
cross1 = !cross1;
}
if (cross1)
{
foreground = GetForegroundWindow();
hdc = GetDC(foreground);
HPEN hPen;
hPen = CreatePen(PS_INSIDEFRAME, 1, RGB(0,255,0));
SelectObject(hdc, hPen);
MoveToEx(hdc, x - 10, y, NULL);
LineTo (hdc, x + 10, y);
MoveToEx(hdc, x, y - 10, NULL);
LineTo(hdc, x, y + 10);
UpdateWindow(foreground);
ReleaseDC(foreground,hdc);
}
else if (GetAsyncKeyState(VK_F11) & (1 == 1))
exit(0);
Sleep(1);
}
return 0;
}
SDS