[plt-scheme] MysterX only responding to COM events with no parameters

From: Jeff Dik (s450r1 at gmail.com)
Date: Mon Aug 4 17:49:25 EDT 2008


I've been trying to get MysterX to respond to COM events for the past
couple of days.  The only COM events I can get it to respond to are
events that do not have any parameters, for example, the OnQuit event
for InternetExplorer.Application, the Click event for
MSCAL.Calendar.7, and the PerformUserValidationTrigger for a COM
component I use at work.

Here is the Scheme script that I've been using to test Internet Explorer events:

    (module ie mzscheme

      (require mzlib/class)
      (require mysterx)

      (define ie (cci/progid "InternetExplorer.Application"))

      (com-register-event-handler ie "NavigateComplete2" (lambda args
(display "NavigateComplete2\n")))
      (com-register-event-handler ie "DocumentComplete" (lambda (pDisp
url) (display "DocumentComplete\n")))
      (com-register-event-handler ie "OnFullScreen" (lambda
(fullscreen) (if fullscreen (display "Fullscreen\n") (display "Not
      (com-register-event-handler ie "OnVisible" (lambda (visible) (if
visible (display "Visible\n") (display "Not visible\n"))))
      (com-register-event-handler ie "OnQuit" (lambda args (display "Quit\n")))

      (com-set-property! ie "Visible" #t)
      (com-invoke ie "Navigate" "http://www.google.com")

      ;; Wait
      (sync never-evt))

The only event that gets displayed is the "OnQuit" event.

Here's the Scheme script I've been using to test Excel (taken from

    (module excel mzscheme

      (require mysterx)

      (define excel (cci/progid "Excel.Application"))

      (com-set-property! excel "Visible" #t)
      (define workbook #f)
      (com-register-event-handler excel "NewWorkbook" (lambda(wb)(set!
workbook wb)(printf "open ~a~%" wb)))
      (com-register-event-handler excel "WorkbookBeforeClose"
(lambda(wb cancel)(printf "closing ~a ~a~%" wb cancel)(set-box! cancel

      ;; Wait
      (sync never-evt))

This script never displays any events.

Does anybody know why the events with parameters are not working?

I'm quite new to MysterX and have been using the MysterX PLT
documentation, the "MysterX: A Scheme Toolkit for Building Interactive
Applications with COM", "Component Support in PLT Scheme", and the
mxdemo.ss script as documentation.  If anybody knows of other good
MysterX documentation, or has a script they would be willing to share,
I'd greatly appreciate it.


Posted on the users mailing list.