Problem with com:invoke-dispatch-method
Hello All,
I'm having a problem and I hope someone can help me. I'm trying to
interact with the WebBrowser ActiveX control in a similar fashion to
the html-viewer.lisp sample that ships with LWW. I am able to call
almost all the methods I need with com:invoke-dispatch-method.
However, I have a requirement to be able to print from the control.
In order to do this, I need to call the ExecWB method and pass in some
parameters (see
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/Objects/WebBrowser.asp).
It takes 4 parameters - an OLECMDID, an OLECMDEXECOPT, a Variant,
and a Variant. In the case of printing, you use OLECMDID with a value
of IDM_PRINT (http://msdn.microsoft.com/workshop/browser/mshtml/reference/constants/idm_print.asp)
and away you go (the last 2 parameters are optional).
I have tried adding a Print button to the html-viewer.lisp sample and
a corresponding callback function that looks like this:
(defun html-viewer-demo-print (self)
(com:invoke-dispatch-method (html-viewer-demo-dispatch self)
"ExecWB"
27 ; IDM_PRINT
1 ; OLECMDEXECOPT_PROMPTUSER))
But I get an error:
Missing value for in/out arg 3.
I try supplying all 4 parameters with a function that looks like this:
(defun html-viewer-demo-print (self)
(let ((temp nil)
(temp2 nil))
(com:invoke-dispatch-method (html-viewer-demo-dispatch self)
"ExecWB"
27 ; IDM_PRINT
1 ; OLECMDEXECOPT_PROMPTUSER
temp
temp2)))
But I get an error:
#<Pointer to type COM:VARIANT = #x008C0108> is not of type CONS.
I've tried various versions of this with temp and temp2 having values
made by make-lisp-variant, fli:allocate-foreign-object, arrays, lists
and I haven't been able to get past the "Pointer to type..." error. I
feel like I'm just missing it somehow.
Can someone please help? I've included a patch below with my changes
to html-viewer.lisp.
Thanks!
Tom
------
--- orig/html-viewer.lisp 2006-01-01 15:34:16.111235200 -0600
+++ print-test/html-viewer.lisp 2006-01-01 15:20:16.564025600 -0600
@@ -32,10 +32,14 @@
(go-button capi:push-button
:text "Go"
:callback 'html-viewer-demo-go
- :callback-type :interface))
+ :callback-type :interface)
+ (print-button capi:push-button
+ :text "Print"
+ :callback 'html-viewer-demo-print
+ :callback-type :interface))
(:layouts
(controls-layout capi:row-layout
- '(address go-button))
+ '(address go-button print-button))
(main-layout capi:column-layout
'(controls-layout html-pane)))
(:default-initargs
@@ -54,6 +58,16 @@
(capi:text-input-pane-text
(slot-value self 'address))))
+(defun html-viewer-demo-print (self)
+ (let ((temp nil)
+ (temp2 nil))
+ (com:invoke-dispatch-method (html-viewer-demo-dispatch self)
+ "ExecWB"
+ 27 ; IDM_PRINT
+ 1 ; OLECMDEXECOPT_PROMPTUSER
+ temp
+ temp2)))
+
(defun test-html-viewer-demo ()
(capi:display (make-instance 'html-viewer-demo)))