Jump to content

Vb6 Autoitdll.dll Autoitdllded


UnrealNeil
 Share

Recommended Posts

I have VB6 and have the AutoItDLL.dll in my application directory

I have added the Module AutoItDLLDed.Bas to my project

My Form load calls AutoItInit (No Errors)

My Timer1 Control Calls IfWinExist and gets a value of 1 returned

However WinActivate and WinClose (and WinKill) don't work

In this example I get Compile Error Expected: =

Private Sub Timer1_Timer()

ZZ = IfWinExist("Solitaire", "")

If ZZ Then

WinActivate("Solitiare","")

WinClose("Solitiare","")

End If

End Sub

There aren't any (I haven't found any) Examples on how to use AutoIt from VB, so I could be doing something wrong.

Can anybody put me right?

Link to comment
Share on other sites

I think, you need to store the return value of the function winactivate() to a variable.

Since winactivate() is a function returning a value ( 1 means success and 0 means failure ), you need to assign the return value to a variable.

ex:

dim x as integer

x=WinActivate("Solitiare","")

Link to comment
Share on other sites

Nah, I got it figured

ditch the Brackets

Private Sub Timer1_Timer()

ZZ = IfWinExist("Solitaire", "")

If ZZ Then

WinActivate "Solitiare", ""

WinClose "Solitiare", ""

End If

End Sub

<{POST_SNAPBACK}>

How about checking spelling? :ph34r:

---> "Solitaire" & "Solitiare"

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

The problem you are running into is that VB6 requires you to put the Call keyword infront of functions calls that take more than one parameter (if you use the parents). As you found... you can skip the call word by just listing the parameters without the parents. If you wanted to use the parents then it would look like this:

Private Sub Timer1_Timer()
    ZZ = IfWinExist("Solitaire", "")
    If ZZ Then
        Call WinActivate("Solitiare", "")
        Call WinClose("Solitiare", "")
    End If
End Sub

tuape is also correct... you need to use the correct spelling of solitaire if you expect the DLL to recognise the window.

Hope this helps!

*** Matt @ MPCS

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...