473,657 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling main thread from a worker thread

I know haw to call a the main thread from a worker thread in a windows form
class, but
how does a worker thread call its main thread from a none windows form
class?

Thank You.

ch***@predictiv econcepts.com
Nov 21 '05 #1
1 1408

It'd be better if the worker object broadcasted events that the main
form listens to. That way you don't have the tight binding of "i call
you and you call me" relationship.

The event broadcasting mechanism in .net takes care of joining the
proper thread (at least that's what I've been told, I haven't actually
found any documentation confirming this).

HTH,

Sam

On Thu, 13 Jan 2005 14:42:24 GMT, "Chad Miller"
<ch**@predictiv econcepts.com> wrote:
I know haw to call a the main thread from a worker thread in a windows form
class, but
how does a worker thread call its main thread from a none windows form
class?

Thank You.

ch***@predicti veconcepts.com


Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1596
by: Ted Miller | last post by:
Hi folks, I originally posted this on microsoft.public.dotnet.framework.interop. Reposting to broaden the audience. I'm having an interop problem where my managed component is reentered from COM on the wrong thread, at which point things seem to go downhill very rapidly. I'm successfully making very heavy use of COM interop elsewhere in my C# code, but I'm having trouble finding a way around this particular problem. This is VS .Net 2003.
15
11760
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that performs the query is contained in a delegate function that I execute via a second thread. On 1 or 2 of the 600+ servers the query hangs. I've tried to use Thread.Join() coupled with a Thread.Abort() but this does not kill the thread. Based on...
5
9890
by: Hao L | last post by:
For example, void WorkerMethod() { ... UnregisterAllHotkeys();} void UnregisterAllHotKeys { for(...) {UnregisterHotKey(...);}} UnregisterHotKey is an API function that must be on the thread that RegisterHotKey was called in order to unregister any of the hot keys RegisterHotkey registered. ("The UnregisterHotKey function frees a hot key previously registered by the calling thread.") Is there any way to call UnregisterAllHotkeys, a...
1
1611
by: Peter | last post by:
I found this awesome example of calling a Main Thread from a worker thread on abstractvb.com but I read through the example and would like to see if anyone can clarify some of this code below: Questions: 1. The Public Sub New proceedure. Is that just a proceedure named new or is there more to this? I went through the code and I do not see any refrences to 'New'
0
245
by: Chad Miller | last post by:
I know how to call a the main thread from a worker thread in a windows form class, but how does a worker thread call its main thread from a none windows form class? Thank You.
2
4132
by: Tim | last post by:
The are 2 threads - main thread and worker thread. The main thread creates the worker thread and then the worker thread runs in an infinite while loop till it is asked to exit by setting an event. The worker thread instantiates an object and calls methods of that object. If some method call fails, the main thread needs to be notified about the failure. What mechanisms exist for notifying the main thread about the worker thread's status -...
6
5986
by: Joe Jax | last post by:
I have an object that spawns a worker thread to process one of its methods. That method processes methods on a collection of other objects. During this processing, a user may request to cancel the entire operation. I could request abort on the worker thread, but that is a) potentially messy, and b) not guaranteed to take immediate effect anyway. I would rather have some way of allowing the main thread to tell the worker thread that it...
1
6171
by: bytebugs | last post by:
Hi, As a matter of principle I have refranied from creating an instance of Form or UserControl from within a class that does not inherit from System.Windows.Form. I am looking for comments on Pros and Cons of the approach. My logic has been that UI is always executed on the main application thread. I use Control.InvokeRequired or delegates to ensure that I am
3
4702
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC application. Furthermore, I use a pointer to an unmanaged function to jump back into the managed dll. The managed part is basically a remoting enhancement which asynchronly
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.