LEADTOOLS Support
General
General Questions
How to use the convert control in a multithreaded application (ApplicationState set to MTA)
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, October 4, 2013 6:34:08 AM(UTC)
Groups: Registered, Tech Support
Posts: 207
Was thanked: 3 time(s) in 3 post(s)
The convert controls's
constructor contains an overload allowing you to specify whether you're creating the control in a windowless environment. A windowless application would include a Windows Service, a Console Application, etc. You'll want to pass in "true" to create the control in this type of environment.
These environments typically have their thread's Apartment State set to MTA, but our controls' default behavior expects the thread's Apartment State to be STA and will throw an exception stating this.
By passing, "true" to the constructor the control can then be used in either an STA thread or an MTA thread and will work in multiple threads.
Attached is an example which uses the convert control to convert a folder of files to the MP4 format (H.264 / AAC).
It allows you to switch between using multiple threads to convert the files or performing the conversion on a single thread. It also allows you to switch between using the ThreadPool and using the Thread class.
The C# application is in Visual Studio 2010 and uses LEADTOOLS Multimedia Version 18.0.
Edited by moderator Friday, August 9, 2019 10:38:29 AM(UTC)
| Reason: Not specified
Travis Montgomery
Senior Sales Engineer
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#2
Posted
:
Monday, February 24, 2014 6:03:08 AM(UTC)
Groups: Registered, Tech Support
Posts: 179
The attached console project uses Multithreading to create 2 convert control instances and do the conversion in parallel.
The project was built using LEADTOOLS v18, VS 2010, .NET Framework 4.0 and creates MTA threads.
Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
LEADTOOLS Support
General
General Questions
How to use the convert control in a multithreaded application (ApplicationState set to MTA)
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.