Jump to content

HELP- importing controlgettext


giorget
 Share

Recommended Posts

i'm tryng to import controlgetext as:

Public Shared Function AU3_ControlGetText(ByVal title As String, ByVal text1 As String, ByVal text As String, Optional ByVal returnTxt As String = "", Optional ByVal buff As Integer = 1000) As String

End Function

when calling function i always get back the "object not set to an istance of an object"

i can't figure out what's wrong.

Any help is very apreciated..

Thanks

G.

Link to comment
Share on other sites

What version of VB are you using?

I know that VB uses the Declare keyword to link to dlls. How are you just using a shared function?

i'm using vb.net vs2003... i think the problem it's something relating pointer to the return buffer... can't figureout :)

Link to comment
Share on other sites

You need to send to the dll a pointer to a buffer in your calling program where the text will be stored.

I haven't used VB much so this is probably clumsy, but it works:

Declare Sub AU3_ControlGetText Lib "AutoItX3.dll" (ByVal title As String, ByVal Txt As String, ByVal Cntrl As String, ByVal returnTxt() As Byte, ByVal buff As Integer)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim buff(1000) As Byte

Dim st As String = ""

Dim i As Integer = 0

AU3_ControlGetText("Untitled", "", "Edit1", buff, 1000)

Do While (buff(i) <> 0)

st = st + Chr(buff(i))

i = i + 1

Loop

MsgBox(st)

End Sub

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...