HtmlHelp
Unable to parse email body. Email id is 4733
Unable to parse email body. Email id is 4733
Hi Nick, On Oct 27, 2005, at 1:41 PM, Nick Levine wrote: > Has anyone had any experience invoking HtmlHelp from Lispworks? Some experience, not completely pleasant :). Below are the remains of some code commented out in my current project. I think there were a few issues I did not solve and I decided to use plain html with a browser for help, similar to Lispworks. If I recall correctly, HTML help insists on being the topmost window which is very annoying if you want to use the help contents as reference when typing something. If you find it useful, please post fixes and improvements back to the list. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL (defvar *help-cookie* nil) (defconstant +hh_display_topic+ 0) (defconstant +hh_display_toc+ 1) ;apparently no different from 0 (defconstant +hh_sync+ 9) ;show the contents for the current topic (defconstant +hh_initialize+ 28) (defconstant +hh_uninitialize+ 29) (fli:register-module :mshelp :real-name "hhctrl.ocx") ; this is right from the docs but does not seem to work - always returns 0 (fli:define-foreign-function (GetActiveWindow "GetActiveWindow") () :result-type win32:hwnd :documentation "Returns the window handle of the active window for the current thread. If no active window is associated with the current thread then it returns 0.") (fli:define-foreign-function (GetForegroundWindow "GetForegroundWindow") () :result-type win32:hwnd) (fli:define-foreign-function (GetDesktopWindow "GetDesktopWindow") () :result-type win32:hwnd) (fli:define-foreign-function (HtmlHelp "HtmlHelp" :dbcs) ((caller win32:hwnd) (file-lpstring :pointer) (command (:unsigned :int)) (data :pointer)) :result-type win32:hwnd :module :mshelp) (defun %help-init () (if *help-cookie* t (progn (setf *help-cookie* (fli:allocate-foreign-object :type :pointer)) (HtmlHelp 0 nil +hh_initialize+ *help-cookie*) (lw:define-action "When quitting image" "Windows help cleanup" '%help-cleanup) *help-cookie*))) ;! add close all entry point (defun %help-cleanup () (when *help-cookie* (HtmlHelp 0 nil +hh_uninitialize+ *help-cookie*) (fli:free-foreign-object *help-cookie*) (setf *help-cookie* nil))) (defun active-window () (let ((win (GetActiveWindow))) (when (zerop win) (setf win (GetForegroundWindow))) win)) ; can only be done from one thread and it must be an interface thread (defun %help-display-topic (path &optional win) (if *application-interface* (let ((active-window (or win (active-window)))) (apply-in-pane-process *application-interface* '%help-display- topic-internal path active-window)) (alert (localize "Unable to load help topic. The main heap thread could not be located.")))) (defun %help-display-topic-internal (path &optional win) (%help-init) (let ((active-window (or win (active-window)))) ;! see about using window representation from interface (unless (zerop active-window) (fli:with-foreign-string (path-ptr element-count byte-count :external-format :unicode) path (declare (ignore element-count byte-count)) (HtmlHelp active-window path-ptr +hh_display_topic+ nil)))))
Unable to parse email body. Email id is 4759
Hi Nick, --- Nick Levine <ndl@ravenbrook.com> wrote: > Sometime last week, I brightly asked > > Has anyone had any experience invoking HtmlHelp from Lispworks? > > ...and by the time we'd got it working some of us had had more > experience with this than we felt we really deserved. > > Now for question two: > > Has anyone had any experience invoking HtmlHelp from a delivered > Lispworks? > > When invoking the same code from a (level 0) delivered CAPI > application, the first (only the first? always the first?) invocation > to HH_DISPLAY_TOPIC fails. .... Reverting back to the last example I submitted, with a small change made to support delivery, works OK for me: (defun demo-help (&rest args) (declare (ignore args)) (display-help-topic "c:\\WINUI.CHM")) (capi:define-interface demo () () (:menus (help-menu "Help" ())) (:default-initargs :title "Demo" :display-state :hidden)) (defparameter *hidden* nil) (defun show-help (&rest args) (capi:execute-with-interface *hidden* #'demo-help)) (capi:define-interface demo-2 () () (:menus (help-menu "Help" (("WinUI" :selection-callback #'show-help)))) (:menu-bar help-menu) (:default-initargs :title "Demo 2")) (capi:define-interface demo-3 () () (:menus (help-menu "Help" (("WinUI" :selection-callback #'show-help)))) (:menu-bar help-menu) (:default-initargs :title "Demo 3")) (defun demo () (setf *hidden* (capi:display (make-instance 'demo))) (capi:display (make-instance 'demo-2)) (capi:display (make-instance 'demo-3))) The first invocation works. Jeff Caldwell __________________________________ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com
Unable to parse email body. Email id is 4796