Video Chat Pro ActiveX Control: Complete Integration Guide

Video Chat Pro ActiveX Control: Complete Integration Guide

Overview

This guide walks through integrating Video Chat Pro ActiveX Control into a Windows desktop application (VB6, VB.NET, C#, or C++/MFC). It covers installation, registration, embedding, basic API usage, event handling, security considerations, deployment, and troubleshooting—providing runnable examples and best practices.

Prerequisites

  • Windows development machine (Windows 10 or later recommended).
  • Visual Studio (for .NET/C++), or VB6 IDE for legacy apps.
  • Administrator privileges for control registration.
  • Video Chat Pro ActiveX installer or OCX file and product license key (if required).
  • Basic knowledge of your language’s COM interop (ActiveX hosting).

Installation & Registration

  1. Copy the provided OCX (e.g., VideoChatPro.ocx) to C:\Windows\SysWOW64 (for 32-bit OCX on 64-bit Windows) or C:\Windows\System32 (match your app bitness).
  2. Open an elevated command prompt and register the control:
    • For 32-bit on 64-bit Windows:

      Code

      cd C:\Windows\SysWOW64 regsvr32 VideoChatPro.ocx
    • For 64-bit or matching bitness:

      Code

      cd C:\Windows\System32 regsvr32 VideoChatPro.ocx
  3. Confirm success message; if registration fails, check digital signature, admin rights, and dependencies (Visual C++ runtimes).

Embedding in Your Project

VB6

  1. Project → Components → Browse → select VideoChatPro.ocx.
  2. Drag the VideoChatPro control from the toolbox onto your form (e.g., VideoChatPro1).
  3. Set properties in the Properties window (e.g., LicenseKey, AutoStart = False).

Example (VB6):

vb

Private Sub Form_Load() VideoChatPro1.LicenseKey = “YOUR_LICENSE_KEY” VideoChatPro1.LocalPreview = True End Sub

Private Sub cmdStartClick() VideoChatPro1.StartSession “room123”, “userA” End Sub

VB.NET / C#

Use COM reference:

  1. Project → Add Reference → COM → select “Video Chat Pro Control” (or Browse to OCX). Visual Studio will generate an interop assembly.
  2. Drag from Toolbox to a Windows Form or instantiate in code.

Example (C#):

csharp

// after adding reference and placing control named videoChatPro1 private void Form1_Load(object sender, EventArgs e) { videoChatPro1.LicenseKey = “YOUR_LICENSE_KEY”; videoChatPro1.LocalPreview = true; } private void btnStartClick(object sender, EventArgs e) { videoChatPro1.StartSession(“room123”, “userA”); }

C++ / MFC

  1. Use ClassWizard to import the OCX as an ActiveX control.
  2. Place the control on a dialog or view and use the generated wrapper methods.

Example (pseudo-C++):

cpp

m_videoChatPro.SetLicenseKey(_T(“YOUR_LICENSE_KEY”)); m_videoChatPro.SetLocalPreview(VARIANT_TRUE); m_videoChatPro.StartSession(_T(“room123”), T(“userA”));

Core API Usage

Common methods/properties/events (names may vary by vendor):

  • Properties: LicenseKey, LocalPreview (bool), RemoteVideoWindow, AudioEnabled.
  • Methods: StartSession(roomId, userId), JoinSession(roomId, userId), LeaveSession(), MuteLocalAudio(bool), SendData(channel, data).
  • Events: OnUserJoined(userId), OnUserLeft(userId), OnMessageReceived(channel, data), OnError(code, message), OnRemoteVideoAttached(userId).

Example sequence:

  1. Set LicenseKey and initialization flags.
  2. Start or join a session.
  3. Handle OnUserJoined to create UI elements for remote video.
  4. Handle OnMessageReceived to process data/controls.
  5. LeaveSession and cleanup on app close.

Event Handling Patterns

  • Use the control’s event delegates (C#/VB) or sink interfaces (C++).
  • Keep UI updates on the main thread—marshal from background threads if needed.
  • Maintain a dictionary mapping userId → video surface for dynamic participants.

Example (C# event handler):

csharp

private void videoChatPro1OnUserJoined(string userId) { this.Invoke(() => { // create remote video container and attach var panel = new Panel { Width = 320, Height = 240 }; this.Controls.Add(panel); videoChatPro1.AttachRemoteVideo(userId, panel.Handle); }); }

Security & Permissions

  • Always run registration and installer with elevated rights.
  • Use secure session tokens rather than plain room IDs where supported.
  • Encrypt signaling and media (TLS/SRTP) if the control supports it.
  • Validate and sanitize any inbound data channels.
  • Limit permissions: enable camera/microphone only when needed; provide user consent UI.

Deployment Best Practices

  • Match control bitness with your application (32-bit app → 32-bit OCX).
  • Include redistributable runtimes (VC++ redistributable) required by the OCX.
  • Automate registration in your installer (use regsvr32 in install scripts or MSI custom actions).
  • Use licensing/activation APIs per vendor guidelines; do not hardcode keys.
  • Test installation on clean VMs for each supported Windows version.

Troubleshooting

  • Registration fails: run regsvr32 from an elevated prompt and verify path/bitness.
  • Control not visible: ensure container supports ActiveX and handles window parenting.
  • Events not firing: check that event sinks are wired and object lifetime persists.
  • Audio/video missing: verify device permissions, default device selection, and codecs.
  • Access denied errors: check UAC and run-time privileges.

Example Mini Checklist (Before Release)

  • OCX registered for target bitness.
  • Interop assembly included (if .NET).
  • Device permission prompts implemented.
  • Secure tokens and encrypted transport configured.
  • Installer registers and unregisters control cleanly.
  • End-to-end tests on target Windows versions.

Appendix — Sample Workflows

Quick Start (user flow)

  1. Register control and add to project.
  2. Set LicenseKey, enable LocalPreview.
  3. StartSession or JoinSession with secure token.
  4. On remote join, attach remote video surfaces.
  5. On exit, call LeaveSession and release control.

Cleanup code snippet (C#)

csharp

private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { videoChatPro1.LeaveSession(); Marshal.ReleaseComObject(videoChatPro1); } catch { /* log or ignore */ } }

If you want, I can produce a ready-to-run sample project for C#, VB6, or C++ with full code files and an installer script.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *