Page 1 of 2

Mozilla WebBrowser

Posted: 19 Feb 2010 10:24
by Tonton Luc
Hi,
Is it possible to make a "mozillaBrowser" control in VP7.2 ?
If yes, how ?
I need it because copy and paste functions using execWB (or manually with mouse) with webBrowser control doesn't works.
I've tried to download "Mozilla ActiveX Control 1.7.12" and register like "regsvr32 mozctlx.dll" (as I see in this post http://discuss.visual-prolog.com/viewto ... ht=mozilla), but when I try to create a new Com Package in my project, VP7.2 doesn't want.

Posted: 19 Feb 2010 12:37
by Thomas Linder Puls
The type library is in mozctl.dll (i.e. without "x").

Posted: 19 Feb 2010 13:58
by Tonton Luc
Ok, the creation of Com Package works fine now.
Many thanks.
:wink:

Posted: 19 Feb 2010 14:54
by Tonton Luc
Hi,
1) Is it normal : after creating the Com package, any activeX sub-folder appeared in my project ?

2) this following code compile fine but what I need to add instead XXX ?

Code: Select all

constants     idc_browser = 1000. facts     browser : iWebBrowser2_import := uncheckedConvert(iWebBrowser2_import,null).   predicates     onShow : window::showListener. clauses     onShow(_Source, _Data):-         Rct = vpi::winGetClientRect(This:getVpiWindow()),         Container = activeXContainer::new(This:getVpiWindow()),         Container:attachListener(browserListener),         Obj=Container:createControl(mozillaBrowser::componentClassID,Rct,idc_browser),         if not(Obj=uncheckedConvert(iOleObject_native,null)) then             _=Obj:queryInterface(iWebBrowser2_native::iid,IUnk),             IDisp=uncheckedConvert(iWebBrowser2_native,IUnk),               XXX           end if         .

Posted: 19 Feb 2010 20:36
by Thomas Linder Puls
It is an ActiveX control, but the constructors have not marked the component as a control in the type liberary.

During registration it does however seem to be registered as a control anyway.

We have seen this kind of mistakes in other type libraries, so I guess we will have provide some means for manually overruling.

Anyway, it seems that you will have to create the control code manually. If you import some other component you can see how the code looks.

Posted: 23 Feb 2010 8:15
by Tonton Luc
Hi,
This following code generate an error :

Code: Select all

clauses     onShow(_Source, _Data):-         HomePage="http://discuss.visual-prolog.com/",         M = mozillaBrowser::new(),         M:navigate(HomePage,comDomains::unsigned(0x0),comDomains::null,comDomains::null,comDomains::null)          .
What's wrong ?

Posted: 23 Feb 2010 11:36
by Tonton Luc
Hi,
I've changing my code and now I've this error :

Code: Select all

facts mb:mozillaBrowser:=erroneous.   clauses     onShow(_Source, _Data):-         mb := mozillaBrowser::new(),         !.   predicates     onBt_navgClick : button::clickResponder. clauses     onBt_navgClick(_Source) = button::defaultAction:-         HomePage="http://discuss.visual-prolog.com/",         mb:navigate(HomePage,comDomains::unsigned(0x0),comDomains::null,comDomains::null,comDomains::null)         .
:shock:

========================================
Dump: 2010/02/23 12:31:17
----------------------------------------
Exception: e_unexpected_exception (com/visual-prolog/com/exceptionHandling/exceptionHandling_exception)

Catastrophic failure

HRESULT code = 2147549183
HRESULT hex code = 8000FFFF
hresultDescription = Catastrophic failure
Predicate name = navigate
URL = http://discuss.visual-prolog.com/

raised() 2010/02/23 12:30:54
ThreadId=5228
ClassInfo: iWebBrowser_import


C:\Program Files\Visual Prolog 7.2\pfc\exception\exception.pro(187)
d:\1travail\prolog_7_2\tests\mozillabrowser\Exe\VIP7Kernel.dll (0x14009854)
C:\Program Files\Visual Prolog 7.2\pfc\exception\exception.pro(187)
C:\Program Files\Visual Prolog 7.2\pfc\com\exceptionHandling\comExceptionCheck.pro(415)
C:\Program Files\Visual Prolog 7.2\pfc\com\exceptionHandling\comExceptionCheck.pro(355)
C:\Program Files\Visual Prolog 7.2\pfc\com\exceptionHandling\comExceptionCheck.pro(339)
d:\1travail\prolog_7_2\tests\mozillabrowser\moz\import\iWebBrowser_import.pro(80)
C:\Program Files\Visual Prolog 7.2\pfc\gui\Controls\button.pro(95)
C:\Program Files\Visual Prolog 7.2\pfc\gui\Window.pro(1106)
C:\Program Files\Visual Prolog 7.2\pfc\gui\drawWindow.pro(423)
C:\Program Files\Visual Prolog 7.2\pfc\gui\Dialog.pro(136)
d:\1travail\prolog_7_2\tests\mozillabrowser\Exe\VIP7Kernel.dll (0x14009B55)
d:\1travail\prolog_7_2\tests\mozillabrowser\Exe\vip7vpi.dll (0x153215B0)
d:\1travail\prolog_7_2\tests\mozillabrowser\Exe\vip7vpi.dll (0x15315527)
d:\1travail\prolog_7_2\tests\mozillabrowser\Exe\vip7vpi.dll (0x15316D8F)
d:\1travail\prolog_7_2\tests\mozillabrowser\Exe\vip7vpi.dll (0x1531FE5B)
C:\WINDOWS\system32\USER32.dll (0x7E398734)
C:\WINDOWS\system32\USER32.dll (0x7E3A3CE4)
C:\WINDOWS\system32\USER32.dll (0x7E3A3B30)
C:\WINDOWS\system32\USER32.dll (0x7E3A3D5C)
C:\WINDOWS\system32\USER32.dll (0x7E398734)
C:\WINDOWS\system32\USER32.dll (0x7E398816)
C:\WINDOWS\system32\USER32.dll (0x7E3A927B)
C:\WINDOWS\system32\USER32.dll (0x7E3A92E3)
C:\WINDOWS\WinSxS\X86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\COMCTL32.dll (0x773B7354)
C:\WINDOWS\WinSxS\X86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\COMCTL32.dll (0x773B7436)
C:\WINDOWS\WinSxS\X86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\COMCTL32.dll (0x773B973B)
C:\WINDOWS\system32\USER32.dll (0x7E398734)
C:\WINDOWS\system32\USER32.dll (0x7E398816)
C:\WINDOWS\system32\USER32.dll (0x7E3AA013)
C:\WINDOWS\system32\USER32.dll (0x7E3AA039)

----------------------------------------
OS information:

Microsoft Windows XP OS version not supported or bad data. Service Pack 3 (Build 2600)
Number Of Processors: 2 PageSize: 4096 Processor: 586 level: 15 revision: 1025
ProcessorNameString: Intel(R) Pentium(R) 4 CPU 3.20GHz
VendorIdentifier: GenuineIntel
Identifier: x86 Family 15 Model 4 Stepping 1
~MHz: 3211

Posted: 23 Feb 2010 14:23
by Thomas Linder Puls
It does not look like you have created Active X wrap code (manually; unfortunately).

The Active X will first of all have to become a control that you can place in a form and show on the screen.

I would not expect the that you can navigate anywhere, until the control is created (i.e. as a window).

Posted: 23 Feb 2010 14:34
by Tonton Luc
Ok, I stop this project.

Posted: 24 Feb 2010 8:56
by Thomas Linder Puls
That is of course a safe decision.

But I actually don't think it is very difficult to mimic the ActiveX wrap code from another control (e.g. the webBrowser control).

Posted: 6 Aug 2014 12:50
by Tonton Luc
Hi,


After register my Mozilla WebBrowser (version 1.7.12) mozctl.dll (using regsvr32), I've created a new VP 7.3 project and add the Mozilla COM component.

On the onClick of a button in a form, I use this following code :

Code: Select all

facts browser : iWebBrowser2_import := uncheckedConvert(iWebBrowser2_import,null).   predicates     onBt_start_navigClick : button::clickResponder. clauses     onBt_start_navigClick(_Source) = button::defaultAction:-         Rct = vpi::winGetClientRect(This:getVpiWindow()),         Container = activeXContainer::new(This:getVpiWindow()),         Container:attachListener(browserListener),         Obj=Container:createControl(mozillaBrowser::componentClassID,Rct,idc_browser),         if not(Obj=uncheckedConvert(iOleObject_native,null)) then             _=Obj:queryInterface(iWebBrowser2_native::iid,IUnk),             IDisp=uncheckedConvert(iWebBrowser2_native,IUnk),             browser := iWebBrowser2_import::new(IDisp),             HomePage="http://www.visual-prolog.com/",               browser:navigate(HomePage,comDomains::null,comDomains::null,comDomains::null,comDomains::null) % !!! this line generate an error   %            browser:navigate(HomePage,comDomains::unsigned(0x0),comDomains::null,comDomains::null,comDomains::null) %            browser:navigate(HomePage,comDomains::variant(comDomains::integer(0)),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string(""))) %            browser:navigate(HomePage,comDomains::variant(comDomains::integer(0)),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string(""))) %            browser:navigate(HomePage,comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string(""))) %        browser:navigate2(comDomains::variant(comDomains::string(HomePage)),comDomains::unsigned(0x0),comDomains::null,comDomains::null,comDomains::null) %        browser:navigate2(comDomains::variant(comDomains::string(HomePage)),comDomains::unsigned(0x0),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string(""))) %        browser:navigate2(comDomains::variant(comDomains::string("")),comDomains::unsigned(0x0),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string("")),comDomains::variant(comDomains::string("")))         end if         .  
And the navigate call generate this error :


========================================
Dump: 2014/08/06 12:41:14
----------------------------------------
Exception: e_fail_exception (com/visual-prolog/com/exceptionHandling/exceptionHandling_exception)

Unspecified error

HRESULT code = 2147500037
HRESULT hex code = 80004005
hresultDescription = Unspecified error
Predicate name = navigate
URL = http://www.visual-prolog.com/

raised() 2014/08/06 12:41:12
ThreadId=7772
ClassInfo: iWebBrowser_import
What's wrong ? Do I forget something ?

Posted: 6 Aug 2014 14:53
by Tonton Luc
Hi,

I've only a VP 7.3 webBrowser sample (any webBrowserControl sample). Does it exist in VP 7.3 ? ...or can I have 7.4 onr only to see the sources ?

In other hand, my project's Mozilla component folder only contain 3 subfolders named :
- export
- import
- native

That's all (any activeX subfolder).

Posted: 6 Aug 2014 15:01
by Thomas Linder Puls
You should import the mozillaBrowserControl from "mozclt.dll"
It makes this code work quite well:

Code: Select all

clauses     new(Parent):-         formWindow::new(Parent),         generatedInitialize(),         mz := mozillaBrowserControl::new(This),         mz:setPosition(10, 10),         mz:setSize(200, 200),         postAction({ :-             HomePage = comDomains::string("http://www.visual-prolog.com"),             mz:get_IWebBrowser2_import():navigate2(HomePage,comDomains::null,comDomains::null,comDomains::null,comDomains::null)         }).   facts     mz : mozillaBrowserControl.
In 7.3 you don't have postAction and anonymous predicates, so you should perform the navigate2 in a show listener.

Posted: 6 Aug 2014 15:21
by Tonton Luc
But how to import the mozillaBrowserControl from "mozclt.dll" ?

Posted: 6 Aug 2014 21:13
by Thomas Linder Puls
Well, mine have a control also. Which versions of the mozilla control did you install? They may have corrected the type library!