IEHtmlWin and embedding webpage on wxWindows

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
Sun
Knows some wx things
Knows some wx things
Posts: 39
Joined: Sat Mar 03, 2007 3:19 pm

IEHtmlWin and embedding webpage on wxWindows

Post by Sun »

Hi,

I have to embed a web page in a wxWinodw, i tried to use wxHTML but it doesn't support external link, like http://...

I tried to use wxIEHtmlWin, but i cant compile its files, i get some errors like

Code: Select all

IID_IServiceProvider undeclared (first use this function)
I use wxDev-c++, latest wxWidgets libs.

I cannot use wxMozilla because not every windows user has it..

Thanks for any suggestion
tan
wxWorld Domination!
wxWorld Domination!
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan »

Hi, i know nothing about wxIEHtmlWin :) but i know where is defined IID_IServiceProvider. Do you have Windows SDK? If not, get it free from www.microsoft.com.
Include this line:

Code: Select all

#include <ServProv.h>
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
Sun
Knows some wx things
Knows some wx things
Posts: 39
Joined: Sat Mar 03, 2007 3:19 pm

Post by Sun »

Finally i success to embed an IE Window in my wxApp.

I have another question... What about wxIEHtml events ? ie how to catch an user-clickonlink event ?
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

Sun wrote:Finally i success to embed an IE Window in my wxApp.

I have another question... What about wxIEHtml events ? ie how to catch an user-clickonlink event ?
Same question. Have you managed to capture the event?
Sun
Knows some wx things
Knows some wx things
Posts: 39
Joined: Sat Mar 03, 2007 3:19 pm

Post by Sun »

yes, there's a sample code:

Code: Select all


EVT_ACTIVEX(ID_WXIEHTMLWIN1, DISPID_BEFORENAVIGATE2, Frame::WxIEHtmlWinNavigateBegin)


void Frame::WxIEHtmlWinNavigateBegin(wxActiveXEvent& event)
{
   wxMessageBox(event["Url"]);
   event["Cancel"] = true;
   //...
 
}
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

Sun wrote:yes, there's a sample code:

Code: Select all


EVT_ACTIVEX(ID_WXIEHTMLWIN1, DISPID_BEFORENAVIGATE2, Frame::WxIEHtmlWinNavigateBegin)


void Frame::WxIEHtmlWinNavigateBegin(wxActiveXEvent& event)
{
   wxMessageBox(event["Url"]);
   event["Cancel"] = true;
   //...
 
}
Thanks for your reply. However I got an error message "error C2065: 'LDISPID_BEFORENAVIGATE2' : undeclared identifier". My question is where did you get the DISIP for activex event?
Sun
Knows some wx things
Knows some wx things
Posts: 39
Joined: Sat Mar 03, 2007 3:19 pm

Post by Sun »

i've searched a little while.
You can also use strings like "DocumentComplete" or "ProgressChange"

Code: Select all

EVT_ACTIVEX(ID_WXIEHTMLWIN1, "ProgressChange", ...)
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

Sun wrote:i've searched a little while.
You can also use strings like "DocumentComplete" or "ProgressChange"

Code: Select all

EVT_ACTIVEX(ID_WXIEHTMLWIN1, "ProgressChange", ...)
Thank you so much.

This one works. But I'm wondering how do you get the event id or event name. If I can find these info I can get whatever event I want.
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

Now I know all the info is in exdisp.h and exdispid.h. The exdisp.h is created by MIDL compiler. My next question is how to generate .h files from ocx. Because ie browser is microsoft's product, so its platform sdk comes with a exdisp.h. If I want to use flash.ocx for example, how can I generate .h file? I know COM/OLE viewer utility can generate a idl file. But when I use midl to compile the idl file, it only generated a tlh file which is not I want. If there a way to generate a .h file so I can use it to call method in flash.ocx like wxIEHtmlWin does?
tan
wxWorld Domination!
wxWorld Domination!
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan »

Hi,
i don't know exactly, but a long time ago i had used M$ excel in my c++ project. I did:

Code: Select all

#import <mso9.dll> no_namespace
i suppose you can try the next:

Code: Select all

#import <flash.ocx> no_namespace
in your *.cpp file, that will generate two include files.
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

tan wrote:Hi,
i don't know exactly, but a long time ago i had used M$ excel in my c++ project. I did:

Code: Select all

#import <mso9.dll> no_namespace
i suppose you can try the next:

Code: Select all

#import <flash.ocx> no_namespace
in your *.cpp file, that will generate two include files.
Thank you so much. I managed to generate .h file by using midl and compile my application successfully. Now it can load and play flash already.

But your method works too. And I think it's better because I don't need to generate the idl and create .h file by myself.

I'll try to capture event from flash and send command to it. If this works,I'll post my code as a simple wxFlashWin.

Thank you for your help agian.
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

I got some more problems to play flash. Maybe this is not the right place to ask. But I'm using wxWidgets and I don't know whether other forum provide help or not. So I post my question here.

Inside flash9b.tlh file, the event declaration is like:

Code: Select all

struct __declspec(uuid("d27cdb6d-ae6d-11cf-96b8-444553540000"))
_IShockwaveFlashEvents : IDispatch
{
    //
    // Wrapper methods for error-handling
    //

    // Methods:
    HRESULT OnReadyStateChange (
        long newState );
    HRESULT OnProgress (
        long percentDone );
    HRESULT FSCommand (
        _bstr_t command,
        _bstr_t args );
    HRESULT FlashCall (
        _bstr_t request );
};
In my program:

Code: Select all

BEGIN_EVENT_TABLE(testflashPanel, MainPanel)
	EVT_ACTIVEX(ID_FLASH_WIN, "OnReadyStateChange", testflashPanel::onReadyStateChange)
	EVT_ACTIVEX(ID_FLASH_WIN, "FSCommand", testflashPanel::onFSCommand)
END_EVENT_TABLE()
The first event is captured in my program without any problem. But I can't capthure "FSCommand" event although the ActionScript sending "FSCommand" is correct. Furthermore I found the buttons in flash doesn't work either. I guess this maybe the cause I can't capture "FSCommand" event. If I open the flash with wxIEHtmlWin, it seems the flash works properly. All the buttons response correctly. I don't know what I missed in my coding. Here is the code to load and play the flash.

Code: Select all

void wxFlashWin::loadFlash(const wxString& file,bool loop)
{
	VARIANT_BOOL b = loop?VARIANT_TRUE:VARIANT_FALSE;
	m_flashInterface->put_Loop(b);
	m_flashInterface->put_Movie((BSTR)(const wchar_t *)file.wc_str(wxConvLocal));
	m_flashInterface->Play();
}
Can anybody advise?

Thanks[/code]
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

The funnest thing is normal animation is ok for the flash. But any flash with buttons got problems. Even animation stops working if there is any buttons included. I've tested the flash by using wxIEHtmlWin without any problems. So that means there must be something wrong in the container. But what could be wrong? I have no clue at all.
Post Reply