If the paper is original articles, reprint please indicate the original source This article blog: blog.csdn.net/qq21497936/…

Long-term continuous bring more projects and technology to share, consultation please add QQ:21497936, wechat: yangsir198808

Development technology set (including Qt practical technology, raspberry PI, 3D, OpenCV, OpenGL, FFMPEG, OSG, SCM, soft and hard combination, etc.) continue to update… (Click on the portal)

Qt Development Column: Development techniques

内 容 提 要 : Qt calls Activex controls developed by Qt…


preface

Develop Activex controls for other applications to call, this chapter explains C# calls Activex controls, not limited to Qt developed Activex controls. To make Wpf calls to Activex controls, it is necessary to wrap the Activex controls in C# and provide them to Wpf calls.


Demo

  


C# calls the Activex method

Step 1: Register the ActiveX control

Use Qt to register idc before running.

idc -regserver activeHelloWorldDemo.dll
Copy the code

  

Step 2: Confirm the CLSID of the activeQt control

Take a look, open the registry and search to confirm the CLSID, as shown below:

"2F12BFB8-137D-4DC2-9A93-634EFE5A6DFC"
Copy the code

Step 3: create a c# project and import a com DLL

Introduce the registered DLL into the project as shown below:

     

Step 4: Use controls in your code

  

Step 5: Write code

private void button1_Click(object sender, EventArgs e)
{
    activeHelloWorldDemoLib.activeHelloWorldDemo dlg = new activeHelloWorldDemoLib.activeHelloWorldDemo();
    dlg.show();
}
Copy the code


The source code

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace trainSimulationDemo { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { activeHelloWorldDemoLib.activeHelloWorldDemo dlg = new activeHelloWorldDemoLib.activeHelloWorldDemo(); dlg.show(); }}}Copy the code


内 容 提 要 : Qt calls Activex controls developed by Qt…