TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Cutch
NA
14
0
Invokng in C++
Jun 22 2008 5:42 PM
Okay,
I have two threads, the main thread with the form, and a background thread from a background worker.
I have to change a string variable declared in the main thread, from the background thread.
I've tried a bunch of different invoking methods, but i can't find any that work.
Any help would be great. Thanks in advance.
---------Edit---------
Okay i have gotten the invoke fine after some work and research,
this->BeginInvoke(gcnew MyDelegate(this, &Form1::myMethod));
but now when it runs in the background thread, when it reaches the invoke line i get this error:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
Additional information: Invoke or BeginInvoke cannot be called on a control until the window handle has been created
.
I'm stumped I've looked around and can't find anything that solve this problem.
I have figured that the error is probably caused by the other thread which is running some other stuff, like painting a picture box, and refreshing the form.
Reply
Answers (
0
)
Control.Size returning 'wrong' value
ATL COM