Jump to content
Sign in to follow this  
giorget

HELP- importing controlgettext

Recommended Posts

giorget

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.

Share this post


Link to post
Share on other sites
Richard Robertson

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?

Edited by Richard Robertson

Share this post


Link to post
Share on other sites
giorget

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 :)

Share this post


Link to post
Share on other sites
BobK

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.