UnrealNeil Posted August 16, 2004 Posted August 16, 2004 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?
sl_alagappan Posted August 17, 2004 Posted August 17, 2004 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","")
UnrealNeil Posted August 18, 2004 Author Posted August 18, 2004 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
tuape Posted August 18, 2004 Posted August 18, 2004 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? ---> "Solitaire" & "Solitiare"
LOULOU Posted September 14, 2004 Posted September 14, 2004 How about checking spelling? ---> "Solitaire" & "Solitiare" <{POST_SNAPBACK}>yOU HAVE TO CREATE AN OBJECT BEFORE USING winactivATE
Matt @ MPCS Posted September 28, 2004 Posted September 28, 2004 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
Guest Guidosoft Posted September 29, 2004 Posted September 29, 2004 But if you remove the parents then they will never grow up right.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now