Gold Panther
2008-03-12 18:54:50 UTC
I have a main dialog. On that dialog there is a button that brings up
a new dialog that should have a web browser on it. The new dialog
fails, because the control has not been created yet as stated by the
commented MS code:
"not an OLE control (not yet, at least)."
I happened upon a post or website talking about acquiring a license
for the control to create it dynamically. I figured since the dialog
is created dynamically that that means the web browser is probably
considered dynamically created. I tried doing the following:
CLSID stuff = m_webBrowser.GetClsid();
if(SUCCEEDED( hr = CoGetClassObject( m_webBrowser.GetClsid(),
CLSCTX_ALL, NULL,
IID_IClassFactory2, (LPVOID *)&pClassFactory )) )
{
LICINFO license;
if( SUCCEEDED(pClassFactory->GetLicInfo( &license )) )
{
if( SUCCEEDED(pClassFactory->RequestLicKey( 0, &bstrLicense )) )
{
if( bstrLicense == NULL )
{
EndDialog( 1 );
}
else
{
m_webBrowser.Create( NULL, WS_VISIBLE, CRect(0, 0, 200, 200 ),
this, IDC_EXPLORER1,
NULL, NULL, bstrLicense );
SysFreeString( bstrLicense );
}
}
else
{
EndDialog( 1 );
}
}
else
{
EndDialog( 1 );
}
}
else
{
EndDialog( 1 );
}
The call to CoGetClassObject fails with a CLASS_E_CLASSNOTAVAILABLE.
The variable "stuff" recognizes the CLSID while debugging as the CLSID
for the Microsoft Web Browser. After this license attempt, I have
just beat my head against a wall. How would I go about doing what I
want to do? What am I doing wrong? Thanks for responses.
a new dialog that should have a web browser on it. The new dialog
fails, because the control has not been created yet as stated by the
commented MS code:
"not an OLE control (not yet, at least)."
I happened upon a post or website talking about acquiring a license
for the control to create it dynamically. I figured since the dialog
is created dynamically that that means the web browser is probably
considered dynamically created. I tried doing the following:
CLSID stuff = m_webBrowser.GetClsid();
if(SUCCEEDED( hr = CoGetClassObject( m_webBrowser.GetClsid(),
CLSCTX_ALL, NULL,
IID_IClassFactory2, (LPVOID *)&pClassFactory )) )
{
LICINFO license;
if( SUCCEEDED(pClassFactory->GetLicInfo( &license )) )
{
if( SUCCEEDED(pClassFactory->RequestLicKey( 0, &bstrLicense )) )
{
if( bstrLicense == NULL )
{
EndDialog( 1 );
}
else
{
m_webBrowser.Create( NULL, WS_VISIBLE, CRect(0, 0, 200, 200 ),
this, IDC_EXPLORER1,
NULL, NULL, bstrLicense );
SysFreeString( bstrLicense );
}
}
else
{
EndDialog( 1 );
}
}
else
{
EndDialog( 1 );
}
}
else
{
EndDialog( 1 );
}
The call to CoGetClassObject fails with a CLASS_E_CLASSNOTAVAILABLE.
The variable "stuff" recognizes the CLSID while debugging as the CLSID
for the Microsoft Web Browser. After this license attempt, I have
just beat my head against a wall. How would I go about doing what I
want to do? What am I doing wrong? Thanks for responses.