Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2006

Tip: Looking for answers? Try searching our database.

Threading-freezing problem with Window Forms and COM ActiveX Objects

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jjrwork - 24 Mar 2006 11:57 GMT
Hello,

This is the first time I post a message so first of all my apologize about
my poor language.

I have a problem:

I have a Windows Forms (STA) app in which I have to use an ActiveX for a
third partner which takes several seconds to perform their operations. If I
run this methods directly my User Interface becomes "frozen", so I run this
ActiveX/COM in a new thread following this example:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html
/AsyncUI.asp


it works OK if in the thread function I create the COM object, use it, and
destroy. But if I create the COM object in my UI Thread and pass the object
to the new thread to use it, the application UI becomes frozen.

I need to maintain the reference of the COM object to use it along the
application lifetime (the initialization is very slow), so I need a
solution.

I have search on the Internet and I found someone who have the exactly the
same problem, but I don't understand the solution.

http://www.thescripts.com/forum/thread256039.html

Can you give me an example or a piece of advice? I'm absolutely desperate...

Thanks in advance.
Jorge
Stoitcho Goutsev (100) - 24 Mar 2006 15:38 GMT
jjrwork,

In the STA scenarios the com object uses the message loop to do the thread
switching so all the code inside the ActiveX is executed in the same thread.
This is easier to progam and is the most used techniques when developing
ActiveX objects.

What that means for you? Your activeX is created in the main UI thread and
uses your UI thread's message pump. Doesn't mather what thread calls methods
in this ActiveX component all the computation will happen in the main UI
thread and will block the UI of the whole application for the duration of
the call.

Signature

HTH
Stoitcho Goutsev (100)

> Hello,
>
[quoted text clipped - 31 lines]
> Thanks in advance.
> Jorge

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.