Re: EuCOM Help!
- Posted by Antonio Alessi <a.admin at myway.it> Mar 01, 2006
- 492 views
Yes, I see now why I kept using the ver. 2.04: the latest version works with the win32Lib v0.60.x, while my application was developed under the v0.59.1 and I cannot upgrade it for too many problems. So I strived to adapt the new EuCOM version to the previous Winlib and it seems to work fine however. I could not get the same error again until now (but which "same error"?), that's to say no errors. A very good work this EuCOM! I can show you how I have interfaced it to my program, hoping this will answer to your question. After embedding the include shdocvw.ew into the same EuCOM.ew, just after the init_com() instruction, these are the routines that were added to the end of the EuCOM file:
function getURL( sequence fileop) if equal( "help\\", fileop[1..5]) then return HyphenatorDir&"help\\"&fileop[6..$] else return fileop end if end function --- ======== global procedure helpOn_go( atom id, atom bstr, sequence params) bstr = alloc_bstr( getURL( getText(URL))) -- Note that I didn't use WebBrowser_m_Navigate2. I did this in order to -- have invoke call GetIdsOfNames for me to get the dispid of URL. EuCOM stops -- calling GetIdsOfNames at the first atom it runs into, so you have to look up -- Navigate2 as well, rather than using the constant. VOID = invoke( Browser, {"Navigate2", "URL"}, {bstr}, {VT_BSTR}, DISPATCH_METHOD) free_bstr(bstr) end procedure --- ========= global function ExpHelpPage( integer ExpHelp, sequence webUrls) -- activate the Browser sequence prm if not Win then Win = createEx( Window, "", helpWin, 35, 43, {w32Edge, 0}, {w32Edge, 0}, {WS_CHILD, WS_VISIBLE}, 0) prm = getCtlSize( helpWin) -{44, 77} URL = create( Combo, "", Win, 0, 3, prm[1], 200, CBS_AUTOHSCROLL) Browser = create_com_control( WebBrowser_clsid_ix, getHandle( Win), -4, 24, prm[1]+4, prm[2]+2) setHandler( Browser, w32HResize, routine_id( "Resize_theWin")) bar = create( LText, "", Win, -1, 24, {w32Edge, 0}, 2,0) setWindowBackColor( bar, getSysColor( COLOR_WINDOW)) addNewItem( URL, webUrls) setIndex( URL, length( webUrls)) setHandler( {URL, getEdit( URL)}, {w32HChange, w32HKeyPress}, routine_id( "helpOn_go")) else if ExpHelp then closeWindow( Win) else openWindow( Win, 1) setFocus( Browser) end if end if if not ExpHelp then helpOn_go(1,1,{}) end if return not ExpHelp end function --- ========
It deals with a "browser mode"/"normal text window" toggle, where the problem arised at first. For more details you can browse http://www.hyphenator.com/tutorial/context_help.htm - EuCOM is simulated to the bottom of the page. That can give you an idea on how various windows are being opened and closed onto the same area, switching the browser on/off by setVisible( Win, 0/1) (it might look like a miracle that all these do work toghether!). I will keep you informed if any error will appear again. Have a nice day. Antonio Alessi