|
You last visited: Today at 07:15
Advertisement
[HELP] ImageSearchDLL.dll in VB.NET
Discussion on [HELP] ImageSearchDLL.dll in VB.NET within the .NET Languages forum part of the Coders Den category.
04/09/2014, 18:19
|
#1
|
elite*gold: 0
Join Date: May 2009
Posts: 1,050
Received Thanks: 472
|
[HELP] ImageSearchDLL.dll in VB.NET
Iäm trying to use the ImageSearchDLL.dll file made in autoit but in vb.net, i have no errors in my code but when i press the button the application terminates itself and nothing happens. Why ?
Both the window and the image exists under the app is running. the dll files i in the bin folder at the space location as the application.exe
Quote:
Imports System.Runtime.InteropServices
Imports System
Imports AutoItX3Lib
Public Class Form1
<DllImport("ImageSearchDLL.dll", EntryPoint:="ImageSearch")> Public Shared Function ImageSearch(ByVal x1 As Integer, ByVal y1 As Integer, ByVal x2 As Integer, ByVal y2 As Integer, ByVal str As String) As String
End Function
Public Shared Function FindImage(ByVal L As Integer, ByVal T As Integer, ByVal R As Integer, ByVal B As Integer, ByVal F As String) As Integer()
Dim ARTN As Integer() = New Integer(4) {}
'MessageBox.Show(R.ToString());
Dim rtn As String = ImageSearch(L, T, R, B, F)
' MessageBox.Show(rtn)
If rtn = "0" Then
aRTN(0) = 0
Return aRTN
Else
Dim coords As String() = rtn.Split("|"c)
'split return value of imagesearch into array
'int[] aRTN = new int[5]; //declare int array with enough elements
aRTN(0) = Integer.Parse(coords(0))
'convert the string values into ints
aRTN(1) = Integer.Parse(coords(1))
aRTN(2) = Integer.Parse(coords(2))
aRTN(3) = Integer.Parse(coords(3))
aRTN(4) = Integer.Parse(coords(4))
Return aRTN
End If
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim x1 As Integer
Dim y1 As Integer
Dim res() As Integer = FindImage(x1, y1, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, "C:\launcher.play.jpg")
Dim s As New AutoItX3Lib.AutoItX3
s.MouseClick("LEFT", res(1), res(2))
End Sub
End Class
|
|
|
|
04/09/2014, 18:26
|
#2
|
elite*gold: 2932
Join Date: Oct 2009
Posts: 6,966
Received Thanks: 1,097
|
use step by step debugging to find the command that causes the termination
|
|
|
04/09/2014, 18:35
|
#3
|
elite*gold: 0
Join Date: May 2009
Posts: 1,050
Received Thanks: 472
|
Quote:
Originally Posted by tolio
use step by step debugging to find the command that causes the termination
|
yeah i did that now and this line is not loading
Quote:
Public Shared Function FindImage(ByVal L As Integer, ByVal T As Integer, ByVal R As Integer, ByVal B As Integer, ByVal F As String) As Integer()
Dim ARTN As Integer() = New Integer(4) {}
MessageBox.Show(L.ToString() & " - " & T.ToString() & " - " & R.ToString() & " - " & B.ToString() & " - " & F.ToString())
Dim rtn As String = ImageSearch(L, T, R, B, F) ' <- nothing happens here
MessageBox.Show(rtn)
If rtn = "0" Then
aRTN(0) = 0
Return aRTN
Else
Dim coords As String() = rtn.Split("|"c)
'split return value of imagesearch into array
'int[] aRTN = new int[5]; //declare int array with enough elements
aRTN(0) = Integer.Parse(coords(0))
'convert the string values into ints
aRTN(1) = Integer.Parse(coords(1))
aRTN(2) = Integer.Parse(coords(2))
aRTN(3) = Integer.Parse(coords(3))
aRTN(4) = Integer.Parse(coords(4))
Return aRTN
End If
End Function
|
dont know why
|
|
|
Similar Threads
|
C# + ImageSearchDLL.dll(autoIt) again...
11/08/2013 - .NET Languages - 7 Replies
Ahoi =)
Habe ein Problem die ImageSearch.dll in ein C# Projekt einzubinden bzw. dort zu nutzen.
Gibt ja ein paar Beiträge hier aus dem Forum die da sehr Hilfreich waren, leider funktioniert es noch immer nicht.
Mit einer direkten Fehlermeldung könnte ich ja weiter kommen, diese gibt es aber leider nicht.
Das Programm wird einfach geschlossen...
Es geht um dieses Stückchen code:
...
|
C# ImageSearchDll
03/25/2011 - .NET Languages - 2 Replies
Hy Guys.
I want to use ImageSearch in VS(2008 or 2010) C#
I have found this, but this is written for VB:
http://www.elitepvpers.com/forum/epvp-coders-tutor ials/648611-howto-imagesearch-funktion-vb-nutzen.h tml
But i have found this code(below) with google, but this throw me an exception, when i "click" on button, and try to search an image: "System.ExecutionEngineException"
If anybody have a solution, please share with me, thanks.
|
All times are GMT +1. The time now is 07:15.
|
|