Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TWebBrowser problem "Could not obtain OLE control window handle"

Status
Not open for further replies.

engmw

Programmer
Dec 1, 2009
1
SY
Dear All,

I am trying to use TWebBrowser with OpenCV (Open computer vision library).

Simply, I create the browser at runtime with no problem as in the following code:

__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
TWebBrowser* WebBrowser = new TWebBrowser(this);
Form1->InsertControl(WebBrowser);
TWinControl(WebBrowser).Parent = this;
WebBrowser->Align = alClient;
WebBrowser->Visible = true;
WebBrowser->Navigate("}
//---------------------------------------------------------------------------

Now, I added the following code which is related to OpenCV library to load image:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
IplImage* img = cvLoadImage("MyImage.bmp");
}
//---------------------------------------------------------------------------

Now, I compiled the project successfully with no warnings or errors but when the Form is going to launch I get the following message box:
"Could not obtain OLE control window handle"

I think this is related to OLE and I don't have good knowledge in dealing with OLE error messages.

This is the following full code:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "cv.h"
#include "highgui.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
TWebBrowser* WebBrowser = new TWebBrowser(this);
Form1->InsertControl(WebBrowser);
TWinControl(WebBrowser).Parent = this;
WebBrowser->Align = alClient;
WebBrowser->Visible = true;
WebBrowser->Navigate("}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
IplImage* img = cvLoadImage("MyImage.bmp");
}
//---------------------------------------------------------------------------

My question is: What does this message tell exactly? and how to solve this problem?

Your answers will be highly appreciated.

Regards,
engmw
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top