Jump to content

Recommended Posts

Was playing with an activex from HERE.

It's called WindowSystemObject (WSO), so when I use ObjEvent it returns an object called IControlEvents but when I click the button nothing happens (no close exit).

IControlEvents has an OnClick Interface.

Here is the code

Func ObjErrFunc()
    Msgbox(0,"*COM ERROR*",$wsobjErr.windescription & @LF & $wsobjErr.description & @LF & "Line=" & $wsobjErr.scriptline)

Func CloseForm_OnClick($Sender)

global $wsobjErr = ObjEvent("AutoIt.Error","ObjErrFunc")

local $wso = ObjCreate("Scripting.WindowSystemObject")

global $f = $wso.CreateForm(0,0,500,400)
$f.Color  = 0xff00ff
$f.Text   = "Au3 Test WSO"

$b = $f.CreateButton(120,70,120,45,"Exit")
$b.Color = 0xff0000
$b.Font.Name      = "Arial"
$b.Font.Size      = 18
$b.Font.Bold      = True
$b.Font.Underline = True

local $ce = ObjEvent($b,"CloseForm_")  ;returns an object nothing happens when button is clicked

; MsgBox(64,"@Error="&@error,StringFormat("Name\tType\n%s\t%s\n%s\t%s",objname($ce),vargettype($ce),objname($b),vargettype($b)))


Not sure what I am doing wrong?? I wrote the same code in AutoHotKey with ComObjConnect and it all worked. Even fired up VB6 using WithEvents and it also worked fine.

Any help will be appreciated.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...