Author Topic: Internet Explorer - MSW Only  (Read 9359 times)

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Internet Explorer - MSW Only
« on: March 08, 2010, 05:09:29 pm »
I once had a need to embed a browser window inside an application.  After reviewing and evaluating WebKit and wxWebConnect and wxIE, I decided to go with wxIE.  And then, of course, the project was cancelled.  All that work, all that time ... (sigh).

Anyway, I thought some of you Windows users might be interested in the wxIE plugin for wxSmith.  wxIE (actually, it's called wxIEHtmlWin) was originally written by Justin Bradfor and found it's way to the code repository on wxCode website.  The component is no longer actively supported, but that doesn't matter much since it is a very simple component.  However, it does require Active-X support and that Internet Explorer be installed on your machine.  That means it is MicroSoft Windows ONLY.  No Linux implementation here.

However, despite ignoring half the computing world, this is a fairly useful component and makes a nice addition to the wxSmith palette.  The component can be downloaded from either RapidShare or Berlios.  Note that the compiled version was compiled on a Windows XP machine, against CB svn 6168, using wxWidgets 2.8.10 and TDM GCC 4.4.1.

Download links are:


http://rapidshare.com/files/360657869/IE_Compiled_MSW.zip

http://rapidshare.com/files/360656877/IE_Source_Only.zip


http://prdownload.berlios.de/ringowidgets/IE_Compiled_MSW.zip

http://prdownload.berlios.de/ringowidgets/IE_Source_Only.zip




Ringo

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Internet Explorer - MSW Only
« Reply #1 on: March 08, 2010, 05:16:16 pm »
I once had a need to embed a browser window inside an application.  After reviewing and evaluating WebKit and wxWebConnect and wxIE, I decided to go with wxIE.  And then, of course, the project was cancelled.  All that work, all that time ... (sigh).
Welcome to my world. I was using it, too in one of my projects. However, I did modify it a lot already to make t unicode compatible etc...
"all that time ... (sigh)"
True, true, true... :-(

Still: Nice addition... for me at least. ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Internet Explorer - MSW Only
« Reply #2 on: March 09, 2010, 11:34:48 am »
Hmmm... after several trials I receive this error on the linker step:

In file included from C:\Devel\wxWidgets\include/wx/msw/wrapwin.h:58,
                 from C:\Devel\wxWidgets\include/wx/msw/app.h:92,
                 from C:\Devel\wxWidgets\include/wx/app.h:562,
                 from C:\Devel\wxWidgets\include/wx/wx.h:26,
                 from C:\Devel\CodeBlocks\src\plugins\contrib\wxSmithIE\IEHtmlWin.h:8,
                 from C:\Devel\CodeBlocks\src\plugins\contrib\wxSmithIE\wxsIExplore.h:49,
                 from C:\Devel\CodeBlocks\src\plugins\contrib\wxSmithIE\wxsIExplore.cpp:25:
C:\Devel\wxWidgets\include/wx/msw/winundef.h: In function 'HWND__* CreateDialog(HINSTANCE__*, const TCHAR*, HWND__*, BOOL (*)(HWND__*, UINT, WPARAM, LPARAM))':
C:\Devel\wxWidgets\include/wx/msw/winundef.h:39: error: cannot convert 'const TCHAR*' to 'const WCHAR*' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE__*, const WCHAR*, HWND__*, BOOL (*)(HWND__*, UINT, WPARAM, LPARAM), LPARAM)'
C:\Devel\wxWidgets\include/wx/msw/winundef.h: In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, const TCHAR*)':
C:\Devel\wxWidgets\include/wx/msw/winundef.h:70: error: cannot convert 'const TCHAR*' to 'const WCHAR*' for argument '14' to 'HFONT__* CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, const WCHAR*)'
C:\Devel\wxWidgets\include/wx/msw/winundef.h: In function 'HWND__* CreateWindow(const TCHAR*, const TCHAR*, DWORD, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)':
C:\Devel\wxWidgets\include/wx/msw/winundef.h:95: error: cannot convert 'const TCHAR*' to 'const WCHAR*' for argument '2' to 'HWND__* CreateWindowExW(DWORD, const WCHAR*, const WCHAR*, DWORD, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)'
C:\Devel\wxWidgets\include/wx/msw/winundef.h: In function 'HMENU__* LoadMenu(HINSTANCE__*, const TCHAR*)':
C:\Devel\wxWidgets\include/wx/msw/winundef.h:112: error: cannot convert 'const TCHAR*' to 'const WCHAR*' for argument '2' to 'HMENU__* LoadMenuW(HINSTANCE__*, const WCHAR*)'
C:\Devel\wxWidgets\include/wx/msw/winundef.h: In function 'HICON__* LoadIcon(HINSTANCE__*, const TCHAR*)':
C:\Devel\wxWidgets\include/wx/msw/winundef.h:318: error: cannot convert 'const TCHAR*' to 'const WCHAR*' for argument '2' to 'HICON__* LoadIconW(HINSTANCE__*, const WCHAR*)'
C:\Devel\wxWidgets\include/wx/msw/winundef.h: In function 'HBITMAP__* LoadBitmap(HINSTANCE__*, const TCHAR*)':
C:\Devel\wxWidgets\include/wx/msw/winundef.h:331: error: cannot convert 'const TCHAR*' to 'const WCHAR*' for argument '2' to 'HBITMAP__* LoadBitmapW(HINSTANCE__*, const WCHAR*)'
Process terminated with status 1 (0 minutes, 7 seconds)
6 errors, 12 warnings

So I can't build the plugin successfully... Any hints?! :?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: Internet Explorer - MSW Only
« Reply #3 on: March 09, 2010, 01:17:50 pm »
That's strange, I've never seen those messages before.  However, they are obviously compile-time messages, and may have something to do (or may not) with char* conversions between Unicode and Ansi.  In the test project I gave, the only #defines I have on the Build Options -> Compiler tab are

__GNUWIN32__
__WXMSW__

So, by default it's building in Ansi mode.

I'm using TDM's GCC 4.4.1 and wxWidgets 2.8.10. 

Also -- I looked up my copy of "winundef.h", as referenced in your traceback.  It doesn't look anything like yours.  Not a "TChar" to be found.  I can't even find "tchar.h" in this version of wxWidgets (in older versions, that was where TChar was defined).


Which compiler/wxWidgets are you using?

Ringo

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Internet Explorer - MSW Only
« Reply #4 on: March 09, 2010, 02:48:29 pm »
So, by default it's building in Ansi mode.
Ah! So that might be the reason. As C::B is unicode I've changed this project to unicode, too (as I did with all you other wxSmith additions btw...). Could you try to compile in unicode, please?

Which compiler/wxWidgets are you using?
Same: TDM's GCC 4.4.1 and wxWidgets 2.8.10. 
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: Internet Explorer - MSW Only
« Reply #5 on: March 09, 2010, 05:55:27 pm »
So, by default it's building in Ansi mode.
Ah! So that might be the reason. As C::B is unicode I've changed this project to unicode, too (as I did with all you other wxSmith additions btw...). Could you try to compile in unicode, please?

Which compiler/wxWidgets are you using?
Same: TDM's GCC 4.4.1 and wxWidgets 2.8.10. 


Ah! So desu!

I normally work only in Ansi mode (my boss says "Unicode? What's a Unicode?  Can I drink it?")  I'll try this in Unicode, and if I can come up with a bi-code fix.

Ringo

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: Internet Explorer - MSW Only
« Reply #6 on: March 09, 2010, 06:04:49 pm »
Well, that was too easy.  I must have done something wrong.  I compiled it with Unicode enabled, and linked to the (static) Unicode-version of wxWidgets, and it worked first time.  Runs, too.

I attached a zipped copy of my IETest project file; take a look and see if we are doing the same thing.

Ringo


[attachment deleted by admin]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Internet Explorer - MSW Only
« Reply #7 on: March 09, 2010, 08:51:13 pm »
I attached a zipped copy of my IETest project file; take a look and see if we are doing the same thing.
IETest works, just not the linking of the wxSmith plugin (as I wrote). this causes the linker errors in Unicode. The test project is just fine... for me, too.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: Internet Explorer - MSW Only
« Reply #8 on: March 09, 2010, 09:46:10 pm »
It is still strange and bizarre -- I build in Unicode when making the plugins for wxSmith.  Attached is a zip with my wxsIExplore project file.  For reference, I use these #defines in the Build Options -> Compiler tab:

BUILDING_PLUGIN
HAVE_W32API_H
__WXMSW__
WXUSINGDLL
cbDEBUG
wxUSE_UNICODE


And, just to be complete, here is a copy of the build log from (just now) re-building the plugin:
(I put the blank lines in just to make it easier to read)


-------------- Build: wxsSmithIExplore in wxsSmithIExplore - Internet Explorer for MSW ---------------

mingw32-g++.exe -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -include sdk.h -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DwxUSE_UNICODE     -IC:\Local\CBDev\cb6186\src\include -IC:\Local\CBDev\cb6186\src\include\wxscintilla\include -IC:\Local\CBDev\cb6186\src\include\wxFlatNotebook\include -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\defitems -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\propgrid\contrib\include -IC:\Local\wxWidgets-2.8.10\include -IC:\Local\wxWidgets-2.8.10\additions\include -IC:\Local\wxWidgets-2.8.10\lib\gcc_dll\mswu -Isrc -Iimages -I..\src  -c C:\Local\CBDev\IE\src\cguid.cpp -o ..\obj\src\cguid.o

cc1plus.exe: warning: C:\Local\CBDev\cb6186\src\include/sdk.h.gch: not used because `WX_PRECOMP' not defined

mingw32-g++.exe -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -include sdk.h -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DwxUSE_UNICODE     -IC:\Local\CBDev\cb6186\src\include -IC:\Local\CBDev\cb6186\src\include\wxscintilla\include -IC:\Local\CBDev\cb6186\src\include\wxFlatNotebook\include -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\defitems -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\propgrid\contrib\include -IC:\Local\wxWidgets-2.8.10\include -IC:\Local\wxWidgets-2.8.10\additions\include -IC:\Local\wxWidgets-2.8.10\lib\gcc_dll\mswu -Isrc -Iimages -I..\src  -c C:\Local\CBDev\IE\src\wxactivex.cpp -o ..\obj\src\wxactivex.o

cc1plus.exe: warning: C:\Local\CBDev\cb6186\src\include/sdk.h.gch: not used because `WX_PRECOMP' not defined

mingw32-g++.exe -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -include sdk.h -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DwxUSE_UNICODE     -IC:\Local\CBDev\cb6186\src\include -IC:\Local\CBDev\cb6186\src\include\wxscintilla\include -IC:\Local\CBDev\cb6186\src\include\wxFlatNotebook\include -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\defitems -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\propgrid\contrib\include -IC:\Local\wxWidgets-2.8.10\include -IC:\Local\wxWidgets-2.8.10\additions\include -IC:\Local\wxWidgets-2.8.10\lib\gcc_dll\mswu -Isrc -Iimages -I..\src  -c C:\Local\CBDev\IE\wxs\src\wxsIExplore.cpp -o ..\obj\src\wxsIExplore.o

cc1plus.exe: warning: C:\Local\CBDev\cb6186\src\include/sdk.h.gch: not used because `WX_PRECOMP' not defined

In file included from C:\Local\CBDev\IE\wxs\src\wxsIExplore.cpp:34:
(33 copies of this line)
images/IE16.xpm:35: warning: deprecated conversion from string constant to 'char*'

In file included from C:\Local\CBDev\IE\wxs\src\wxsIExplore.cpp:35:
(33 copies of this line)
images/IE32.xpm:51: warning: deprecated conversion from string constant to 'char*'

mingw32-g++.exe -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -include sdk.h -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DwxUSE_UNICODE     -IC:\Local\CBDev\cb6186\src\include -IC:\Local\CBDev\cb6186\src\include\wxscintilla\include -IC:\Local\CBDev\cb6186\src\include\wxFlatNotebook\include -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\defitems -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\propgrid\contrib\include -IC:\Local\wxWidgets-2.8.10\include -IC:\Local\wxWidgets-2.8.10\additions\include -IC:\Local\wxWidgets-2.8.10\lib\gcc_dll\mswu -Isrc -Iimages -I..\src  -c C:\Local\CBDev\IE\wxs\wxsSmithIExplore.cpp -o ..\obj\wxsSmithIExplore.o

cc1plus.exe: warning: C:\Local\CBDev\cb6186\src\include/sdk.h.gch: not used because `WX_PRECOMP' not defined

mingw32-g++.exe -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -include sdk.h -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DwxUSE_UNICODE     -IC:\Local\CBDev\cb6186\src\include -IC:\Local\CBDev\cb6186\src\include\wxscintilla\include -IC:\Local\CBDev\cb6186\src\include\wxFlatNotebook\include -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\defitems -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\wxwidgets\properties -IC:\Local\CBDev\cb6186\src\plugins\contrib\wxSmith\propgrid\contrib\include -IC:\Local\wxWidgets-2.8.10\include -IC:\Local\wxWidgets-2.8.10\additions\include -IC:\Local\wxWidgets-2.8.10\lib\gcc_dll\mswu -Isrc -Iimages -I..\src  -c C:\Local\CBDev\IE\src\IEHtmlWin.cpp -o ..\obj\src\IEHtmlWin.o

cc1plus.exe: warning: C:\Local\CBDev\cb6186\src\include/sdk.h.gch: not used because `WX_PRECOMP' not defined

C:\Local\CBDev\IE\src\IEHtmlWin.cpp: In member function 'void wxIEHtmlWin::SetupBrowser()':

C:\Local\CBDev\IE\src\IEHtmlWin.cpp:220: warning: deprecated conversion from string constant to 'OLECHAR*'

mingw32-g++.exe -shared   -Wl,--dll -LC:\Local\CBDev\cb6186\src\devel -LC:\Local\wxWidgets-2.8.10\lib\gcc_dll -L..\..\..\..\MinGW\lib  ..\obj\src\cguid.o ..\obj\src\wxactivex.o ..\obj\src\wxsIExplore.o ..\obj\wxsSmithIExplore.o ..\obj\src\IEHtmlWin.o   -o ..\bin\wxsSmithIExplore.dll  -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lwxsmithlib -lcodeblocks -lwxmsw28u -lwxbase28u -lwxmsw28u_core

c:/mingw/bin/../lib/gcc/mingw32/4.4.1-dw2/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.

This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.

Info: resolving vtable for wxsWidget by linking to __imp___ZTV9wxsWidget (auto-import)
Info: resolving vtable for wxsStringProperty by linking to __imp___ZTV17wxsStringProperty (auto-import)

Output size is 2.50 MB
Process terminated with status 0 (0 minutes, 8 seconds)
0 errors, 89 warnings
 

 
(The char* warnings come from including XPM files for the button images).

Although, I did notice that if I include the #define __GNUWIN32__ in the plugin, things go a little haywire.  Not exactly the same error you saw, but something similar.  If this doesn't help, send me a copy of your project file, and I'll play with it here and see if I can work it out.

Ringo






[attachment deleted by admin]

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: Internet Explorer - MSW Only
« Reply #9 on: March 10, 2010, 09:49:19 am »
@MortenMacFly -- did you get a chance to look at my project file, and the compiler log?  Did you find anything drastically different from what you do and what I do to compile?

Ringo

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Internet Explorer - MSW Only
« Reply #10 on: March 10, 2010, 10:17:43 am »
Did you find anything drastically different from what you do and what I do to compile?
I tried again - it works now. The reason was that I forgot to add "-include sdk" as a compiler switch. After adding this, it worked. I've attached the project for your convenience. (I also re-structured it so it matches our wxSmith additions philosophy... as I did with the others of yours.)

[attachment deleted by admin]
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: Internet Explorer - MSW Only
« Reply #11 on: March 10, 2010, 11:31:15 am »
Excellant!  I'll d/l your project file, and try to use something closer to that on future uploads.

Ringo