Sign in to follow this  
Followers 0
UnrealNeil

Vb6 Autoitdll.dll Autoitdllded

7 posts in this topic

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?

Share this post


Link to post
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","")

Share this post


Link to post
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

Share this post


Link to post
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"

Share this post


Link to post
Share on other sites

How about checking spelling?  :ph34r:

---> "Solitaire" & "Solitiare"

<{POST_SNAPBACK}>

yOU HAVE TO CREATE AN OBJECT BEFORE USING winactivATE

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

But if you remove the parents then they will never grow up right. :)

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  
Followers 0