Click here to Skip to main content
15,868,025 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralReadFile function Pin
14-May-02 22:54
suss14-May-02 22:54 
GeneralRe: ReadFile function Pin
Niklas L14-May-02 23:24
Niklas L14-May-02 23:24 
GeneralMultiThreaded Progress bar Pin
SamirSood14-May-02 22:36
SamirSood14-May-02 22:36 
GeneralRe: MultiThreaded Progress bar Pin
Jon Hulatt14-May-02 23:57
Jon Hulatt14-May-02 23:57 
GeneralRe: MultiThreaded Progress bar Pin
SamirSood15-May-02 0:14
SamirSood15-May-02 0:14 
GeneralRe: MultiThreaded Progress bar Pin
Todd Smith15-May-02 7:31
Todd Smith15-May-02 7:31 
Generalcode for MultiThreaded Progress bar Pin
Hesham Amin15-May-02 0:45
Hesham Amin15-May-02 0:45 
GeneralRe: code for MultiThreaded Progress bar Pin
Stephen C. Steel16-May-02 11:59
Stephen C. Steel16-May-02 11:59 

Multithreaded apps are simplest if only the main thread deals with drawing the UI, as in your second solution. There is, however, no need to introduce a new message handler in your dialog. Just have the worker thread post a messages directly to the progress control:

Before starting the worker thread, save the window handle of the progress control in a variable that will be accessible to the worker thread (e.g. m_hProgressCtrl). Then in your worker thread code, post messages to update the progress control directly

<br />
::PostMessage (m_hProgressCtrl, PBM_SETRANGE, 0, MAKELPARAM (min, max));<br />
::PostMessage (m_hProgressCtrl, PBM_SETPOS, position, 0);<br />


Using ::PostMessage() (instead of the ::SendMessage() inside the CProgressBar member functions) means that the messages to update the progress controls will be queued for the main GUI thread.


Stephen C. Steel
Kerr Vayne Systems Ltd.


QuestionWriting a driver? Pin
karanba14-May-02 22:21
karanba14-May-02 22:21 
AnswerRe: Writing a driver? Pin
Jon Hulatt14-May-02 23:58
Jon Hulatt14-May-02 23:58 
Generalincloming socket address Pin
Kristian3314-May-02 22:09
Kristian3314-May-02 22:09 
GeneralRe: incloming socket address Pin
Rickard Andersson2014-May-02 22:20
Rickard Andersson2014-May-02 22:20 
GeneralRe: incloming socket address Pin
Nish Nishant14-May-02 22:21
sitebuilderNish Nishant14-May-02 22:21 
GeneralRe: incloming socket address Pin
markkuk14-May-02 22:21
markkuk14-May-02 22:21 
GeneralRe: incloming socket address Pin
Orbital^14-May-02 22:26
Orbital^14-May-02 22:26 
GeneralRe: incloming socket address Pin
Kristian3314-May-02 22:45
Kristian3314-May-02 22:45 
GeneralSTL program Pin
Orbital^14-May-02 21:41
Orbital^14-May-02 21:41 
GeneralRe: STL program Pin
Christian Graus14-May-02 22:00
protectorChristian Graus14-May-02 22:00 
GeneralRe: STL program Pin
markkuk14-May-02 22:08
markkuk14-May-02 22:08 
GeneralRe: STL program Pin
Orbital^14-May-02 22:19
Orbital^14-May-02 22:19 
GeneralRe: STL program Pin
Nish Nishant14-May-02 22:23
sitebuilderNish Nishant14-May-02 22:23 
GeneralRe: STL program Pin
Orbital^14-May-02 22:29
Orbital^14-May-02 22:29 
GeneralRe: STL program Pin
Nish Nishant14-May-02 22:33
sitebuilderNish Nishant14-May-02 22:33 
GeneralRe: STL program Pin
markkuk14-May-02 22:26
markkuk14-May-02 22:26 
GeneralWhy is this so sh*tty ? (CComControlBase::IDataObject_GetData) Pin
Braulio Dez14-May-02 21:36
Braulio Dez14-May-02 21:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.