Wusup AVA coders/players,
So I'm trying to see if AVA window is active or not. But for some reason it's not working. I cannot detect exactly what I'm doing wrong.
Import DLL I am using: There are different ways but I'm using this.
Code:
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindow( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetForegroundWindow() As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindowEx(ByVal parentHandle As IntPtr, _
ByVal childAfter As IntPtr, _
ByVal lclassName As String, _
ByVal windowTitle As String) As IntPtr
End Function
^ I know I don't need the child window, but I just have it there.
This is what I'm trying to do after:
Code:
Dim Trigger As Boolean = GetAsyncKeyState(Keys.LButton)
Dim avaWndw As IntPtr = FindWindow("AVAWindowClass", "Alliance of Valiant Arms")
Dim FGW As IntPtr = GetForegroundWindow()
If avaWndw = FGW Then
If Trigger = True Then
'Macro code here.
End If
End If
Inside the the double If statements, I have my macro code's. Now When AVA is running the macro wont be triggered. However if I comment out the first if statement, then the macro works perfectly fine. Is the way I'm importing the DLL wrong? Or what am I doing wrong?