oliverbowen
asked on
Accessing a Progress bar in View class from thread in mainframe class
I have a Progress Bar control inside my view class for an MFC SDI application.
I created a thread and set the message handlers and thread functions in the MainFrame class.
When I attempt to compile I get an error saying my progress bar variable/control cannot be found where I try to update it in the thread function defined/implemented in the mainframe class.
How do I get access to that control?
I created a thread and set the message handlers and thread functions in the MainFrame class.
When I attempt to compile I get an error saying my progress bar variable/control cannot be found where I try to update it in the thread function defined/implemented in the mainframe class.
How do I get access to that control?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok I got it figured out.
I moved the message handlers and custom messages into the view class, which is where the progress bar control is.
Now in my thread as I'm doing my processing I post a message to the update message handler and it works great.
I pass the counter to the message handler through the lparam of the sendmessage function and that way I'm able to increment the cprogressbar.
Thank you!
I moved the message handlers and custom messages into the view class, which is where the progress bar control is.
Now in my thread as I'm doing my processing I post a message to the update message handler and it works great.
I pass the counter to the message handler through the lparam of the sendmessage function and that way I'm able to increment the cprogressbar.
Thank you!
Without it I can only guess that you forgot to add an appropriate #include in the cpp-file where you use the bar.