Hallo ich habe ein Programm mit GDI gebaut um ein Bild zu zeichnen da Formen nicht im spiel in den Vordergrund gesetzt werden können. Jetzt habe ich das Problem das mein programm die Karte zwar zeichnet nur nicht Ingame. Überall anders schon auch ohne game offen
Bitte um Hilfe
Als Admin schon ausgeführt und getestet? Ja
VB.NET-Quellcode
- Imports System.Threading
- Imports System
- Public Class Form1
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer ' Um Das Fenster zu finden
- Dim mythread As System.Threading.Thread
- Dim picgrößeX As Integer = My.Resources.bitswarzmap.Size.Width
- Dim picgrößeY As Integer = My.Resources.bitswarzmap.Size.Height
- Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As Long
- Public Sub anzeigen(ByVal PictureGrößeX As Integer, ByVal picgrößeY As Integer)
- Dim g As Graphics = Graphics.FromHwnd(New IntPtr(FindWindow("WarZ", "WarZ"))) ' Prozess finden
- Dim posx As Integer = ScreenResolutionX() - PictureGrößeX ' Rechts anordnen
- Dim posy As Integer = ScreenResolutionY() - picgrößeY ' unten anordnen
- g.DrawImage(My.Resources.bitswarzmap, posx, posy, PictureGrößeX, picgrößeY) ' Bild malen
- g.Dispose()
- End Sub
- Public Function ScreenResolutionX() As Integer
- Dim intX As Integer = Screen.PrimaryScreen.Bounds.Width ' Momentaner Screenresolution X finden
- Return intX
- End Function
- Public Function ScreenResolutionY() As Integer
- Dim intY As Integer = Screen.PrimaryScreen.Bounds.Height ' Momentaner Screenresolution Y finden
- Return intY
- End Function
- Dim timerstat As Integer = 0
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- Me.TopMost = True
- If GetAsyncKeyState(Keys.NumPad1) Then
- anzeigen(picgrößeX, picgrößeY) ' Funktion zeichnen aufrufen
- 'Timer2.Start()
- ElseIf GetAsyncKeyState(Keys.NumPad0) Then
- Timer1.Stop()
- MsgBox("Programm beendet!")
- Me.Close()
- ElseIf GetAsyncKeyState(Keys.NumPad2) Then
- ' Timer2.Stop()
- ' Dim rec As New Rectangle(0, 0, ScreenResolutionX, ScreenResolutionY)
- ' Me.Invalidate(rec)
- End If
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Control.CheckForIllegalCrossThreadCalls = False
- Timer1.Start() ' Timer starten um Keys zu überprüfen
- End Sub
- Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
- mythread = New Thread(AddressOf zeigen)
- mythread.Start()
- End Sub
- Public Sub zeigen()
- anzeigen(picgrößeX, picgrößeY)
- End Sub
- End Class
Bitte um Hilfe
Als Admin schon ausgeführt und getestet? Ja