cancel
Showing results for 
Search instead for 
Did you mean: 

SHDocVw and SBO

Former Member
0 Kudos

Hello guys, I'm trying to add an instance os Internet Explorer ActiveX into a SBO form using C#, the code I'm using is the following:

SAPbouiCOM.Form oGenericForm = null;
SAPbouiCOM.FormCreationParams oGenericFormCreationParams = null;
SAPbouiCOM.Item oGenericItem = null;
SAPbouiCOM.ActiveX oActive = null;
SHDocVw.InternetExplorer oSHDocVw = null;
System.Object nullObject = 0;
string str = "";
System.Object nullObjStr = str;
try
{
    oGenericForm = oSBOApplication.Forms.Item("_BrowserForm1");
}
catch
{
    try
    {
        // Main form creation
        oGenericFormCreationParams = (SAPbouiCOM.FormCreationParams)oSBOApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams);
        oGenericFormCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable;
        oGenericFormCreationParams.FormType = "fBrowserForm1";
        oGenericFormCreationParams.UniqueID = "_BrowserForm1";
        oGenericForm = oSBOApplication.Forms.AddEx(oGenericFormCreationParams);
        oGenericForm.Visible = false;
        oGenericForm.AutoManaged = false;
        oGenericForm.Top = 20;
        oGenericForm.Left = 280;
        oGenericForm.Width = 640;
        oGenericForm.Height = 480;
        oGenericForm.Title = "SBO Internet Browser";
        // Web browser activeX component creation
        oGenericItem = oGenericForm.Items.Add("brs", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X);
        oGenericItem.Top = 5;
        oGenericItem.Left = 5;
        oGenericItem.Width = oGenericForm.Width - 10;
        oGenericItem.Height = oGenericForm.Height - 10;

        oActive = ((SAPbouiCOM.ActiveX)(oGenericItem.Specific));
        oActive.ClassID = ((SAPbouiCOM.ActiveX)(oGenericItem.Specific)).ClassID = "Interop.SHDocVw";
        oSHDocVw = ((SHDocVw.InternetExplorer)(oActive.Object));
        
        oSHDocVw.Navigate("http:///sdn.sap.com", ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
    }
    catch (Exception er)
    {
        oSBOApplication.MessageBox(er.Message, 0, "Ok", "", "");
    }
}
oGenericForm.Visible = true;

When I run that code I got the following error message:

Invalid class sequenca (HRESULT: 0x800401F3) (CO_E_CLASSTRING))

Does anyone knows what I'm missing?

I'm probably doing some bad cast, do you have any idea on how to fiz that?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Gabriel Izar,

Please try to change following code to solve the issue:

from


oActive.ClassID = ((SAPbouiCOM.ActiveX)(oGenericItem.Specific)).ClassID = "Interop.SHDocVw";

to


oActive.ClassID = "Interop.SHDocVw";

If the issue still exists, could you debug the code and find out which code line cause the error?

Best Regards

Jane Jing

SAP Business One

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

For me it only works when I changed the following line:

oActive.ClassID = ((SAPbouiCOM.ActiveX)(oGenericItem.Specific)).ClassID = "Interop.SHDocVw";

To:

oActive.ClassID = "Shell.Explorer.2";

Elad

Former Member
0 Kudos

Hello Jane Jing, thank you so much for your reply.

To fix the problem I was having I just did the following:

Where I had:

oActive.ClassID = ((SAPbouiCOM.ActiveX)(oGenericItem.Specific)).ClassID = "Interop.SHDocVw";

Now I have:

oActive.ClassID = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}";

Now the program is working well.