Pelco Developer Network (PDN)

Creating OCC Plug-in from VB6 project

Hi,
I am trying to create an OCC plug-in , as desciribed on OCC document.
As desciribed in document i create a wpf project but i couldn't host our VB6 apllication ( which is developed
on Visual basic 6.0) in a WPF appilcation.

Is there any way to host a VB6 application in WPF, or an idea ?

My WPF codes which does not work are below. Think that VB6TestProject.exe is our VB& project, and trying to host it.

 public MainWindow()
        {
            InitializeComponent();
 
            winHost1 = new System.Windows.Forms.Integration.WindowsFormsHost();
            //winHost1.Parent = this;
 
 
            _panel = new System.Windows.Forms.Panel();
            winHost1.Child = _panel;
            //this.AddChild(winHost1);
            this.myGrid.Children.Add(winHost1);
 
 
 
 
                ProcessStartInfo psi = new ProcessStartInfo("VB6TestProject.exe");
              psi.WindowStyle = ProcessWindowStyle.Normal;
 
 
             _process = Process.Start(psi);
            _process.WaitForInputIdle();
            System.Threading.Thread.Sleep(2000);//****
            //IntPtr h = _process.MainWindowHandle;
            SetParent(_process.MainWindowHandle, _panel.Handle);
 
            // remove control box
            int style = GetWindowLong(_process.MainWindowHandle, GWL_STYLE);
            style = style & ~WS_CAPTION & ~WS_THICKFRAME;
            SetWindowLong(_process.MainWindowHandle, GWL_STYLE, style);
 
            // resize embedded application & refresh
            ResizeEmbeddedApp();
 
        } 

It should be possible - as our best guess. We do have a partner that is using .NET WPF (not VB6) without any modifications and having it launch in a plug-in.

Please forgive me, we have had almost no questions related to plug-in development, and therefore have very little in the way of support. Please take a look at the Forum Guidelines for some suggestions on what might help us to further help you out.

When you say 'it doesn't work' - what does or does not happen? What's your expected behavior? Any error messages of any kind?

Unfortunately we don't have a working sample of code for plug-in development, as I mentioned it isn't something that we have had many questions about in the past. It isn't normal for us to provide code support unless it is specific calls using one of our SDK tools like VX SDK.

What kind of solution are you working on? What company is this for or with?

Sorry, I have updated my account for further information, if we can accomplish integrating our software with Video expert, we are planning to use this integration for any project using pelco cameras.
Yes we also can achive hosting an .net c# application in the wpf application, but VB6. Hosting means the child application fit inside the parent(WPF) application. So, can not hosting means; theese two application are running but separately, one not within the other.
The code I 've shared before is succeeded to host an an application which developed on c# , but can not host an app. developed on VB6.

We are following the instruction below which are mentioned on OCC document. And because of our application is developed on VB6, we are trying to host it in WPF ;

Implementing a Plug-In as an Executable
Alternatively, a plug-in can be implemented as an executable. In this case, the steps are:
1. Create a WPF application.
2. Create a WPF user control, for example, MainUserControl
3. Add MainUserControl to the application’s main window.
...

Thank you.