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 / Languages / Managed C++ / November 2006

Tip: Looking for answers? Try searching our database.

Simple Threading Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gnassar@gmail.com - 28 Nov 2006 09:47 GMT
I'm attempting to use threads in .NET VC++ comming from a strict C
background. Unfortunately I'm a bit rough. I've gotten a rather good
knowlege of VC++ and have been converting projects from VB and C# to
learn how to do them in VC++ .NET.

Unfortunately I can't seem to understand something rather trivial. I
guess it escapes me.

I have a class, Form1. It creates 5 threads. Each thread I'd like to
know the parent address in. So I'd like each thread to know and be able
to access the Inital thread (The one Form1 loads from). Inside Form1 I
have a  function String^ Form1::getString(); It returns a string of
course. I'd like the threads to call that. I have a mutex placed inside
to force multithreaded safety.

How would I go about defining the parent in the threads. Note the
threads are an instantiation of a totally different class than Form1.

Thanks in advance
Bruno van Dooren [MVP VC++] - 28 Nov 2006 10:04 GMT
> I have a class, Form1. It creates 5 threads. Each thread I'd like to
> know the parent address in. So I'd like each thread to know and be able
[quoted text clipped - 5 lines]
> How would I go about defining the parent in the threads. Note the
> threads are an instantiation of a totally different class than Form1.

Hi,

You can use a ParameterizedThreadStart delegate for that, and simply supply
the Form pointer when you start the thread.
See
http://msdn2.microsoft.com/en-us/library/system.threading.parameterizedthreadsta
rt.aspx

for more information and an example.

Signature

Kind regards,
   Bruno.
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"


Rate this thread:







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.