[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

ActiveX.EXE and threading

I have an application that connects to multiple pieces of automated packaging equipment. The main form of my application is just the gui. When the program starts it creates multiple instances of an activex.exe for each piece of packaging equipment. The activex establishes a tcp connection to the machine and monitors its status. It reports back to the main gui status information so the user can take action. My question is if i have the activex set as multi use each instance of the active x running in its own thread? Or do i want these to be single use?
0
Basicfarmer
Asked:
Basicfarmer
  • 2
1 Solution
 
Vadim RappCommented:
If I'm not mistaken, multiuse or singleuse applies to the class, not to exe. So ActiveX exe creates multiple instances of the same class, they run asynchronously, but it's all within one process represented by ActiveX exe. Is that how you have it? if not, then where exactly do you see the choice between single use and multiuse?
0
 
BasicfarmerAuthor Commented:
If I run it as single use and I go to the task manager I see that an activex is running for each instance I have created the class. If I select multiuse, then I only see one activex in the task manager. So I am wondering if using multiuse if a new class is instantiated for each piece of equipment that I am monitoring and if those are all running in their own thread.
0
 
Vadim RappCommented:
Yes, each instance of the class specified as multiuse runs in its own thread. Make sure to specify correct threading model in the Properties of the project. But all this has quite a few nuances, such as avoiding creation of the main form on each thread, using "createobject" instead of "new", and more. Back in times of VB6 ActiveX EXE was the only way to have multithreaded application written in VB*, but today writing .Net-based application in Visual Studio would make much more sense. .Net Framework has far better support for multithreading,

*) we actually have here exactly such an application we created, doing things very similar to yours.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now