Skip to Content
0
Former Member
Sep 09, 2009 at 01:34 AM

show winform in an Activex Control

242 Views

hi all,

usually their is an option to show web Form in an activex Control with the help of the code mentioned below.

Dim oForm As SAPbouiCOM.Form
        Dim creationPackage As SAPbouiCOM.FormCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)

        Try
            creationPackage.UniqueID = "MFormIEID"
            creationPackage.FormType = "sdf"
            creationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable

            '// Add the form to the SBO application
            oForm = SBO_Application.Forms.AddEx(creationPackage)
        Catch ex As Exception
            SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)

            Try
                oForm = SBO_Application.Forms.Item("MFormIEID")
            Catch ex2 As Exception
                SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
                Exit Sub
            End Try
        End Try

        oForm.Visible = True

        Dim oItemX As SAPbouiCOM.Item
        Dim oActX As SAPbouiCOM.ActiveX
        Dim oWebX As SHDocVw.WebBrowser
        Try
            oForm.Width = 700 ' get or create some form before
            oForm.Height = 500
            oItemX = oForm.Items.Add("xyz", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)
            oItemX.Height = oForm.Height - 28
            oItemX.Width = oForm.Width - 8

            oActX = oItemX.Specific
            oActX.ClassID = "Shell.Explorer.2" 'or use the GUID "{8856F961-340A-11D0-A96B-00C04FD705A2}"
            oWebX = oActX.Object
            ' go "Home"
            oWebX.GoHome()
            ' or go to SMP
            oWebX.Navigate("http:\\www.google.com")
        Catch ex As Exception
            SBO_Application.MessageBox(ex.ToString)
        End Try

in the same way i need to show a windowform (vbform) in to ActiveX Control.

can anyone give me the sample...?

regards,

Rob