May
31
Posted (aivan monceller) in Tutorials on May-31-2008

Preparation:

1. Download AutoitX from Autoit’s Website (Autoit’s ActiveX Control).

2. Copy the AutoitX3.dll to windows/system32 folder

3. Register the DLL using “regsvr32 AutoitX3.dll” on the run dialog box, located at the start menu.

4. Open your VB6 project and go to Project>References. Search for AutoitX3.dll and add it to your project.

How to Implement Autoit’s Functions into VB6:

Option Explicit
Dim AU3 As AutoItX3Lib.AutoItX3 'declare the AutoitX DLL

Private Sub Form_Load()
   Dim intResult As Integer 'declare a variable to hold autoitx function return values
   Set AU3 = New AutoItX3Lib.AutoItX3 'create a new instance
End Sub

Private Sub Test_Click()
    ' This will run inetcpl.cpl (Internet Options for IE7 NOT IE6) and delete all cookies
    AU3.Run "control inetcpl.cpl", "", AU3.SW_MAXIMIZE
    AU3.WinWait "Internet Properties"
    AU3.WinSetState "Internet Properties", "", AU3.SW_HIDE
    AU3.ControlClick "Internet Properties", "", "Button4"
    AU3.WinSetState "Delete Browsing History", "", AU3.SW_HIDE
    AU3.WinWait "Delete Browsing History"
    AU3.WinSetState "Delete Browsing History", "", AU3.SW_HIDE
    AU3.ControlClick "Delete Browsing History", "", "Button2"
    AU3.WinWait "Delete Cookies"
    AU3.WinSetState "Delete Cookies", "", AU3.SW_HIDE
    AU3.ControlClick "Delete Cookies", "", "Button1"
    AU3.ControlClick "Delete Browsing History", "", "Button7"
    AU3.ControlClick "Internet Properties", "", "Button12"
End Sub

Check the help file for more of Autoit’s functions.

Share/Save/Bookmark


Post a comment
Name: 
Email: 
URL: 
Comments: