Click here to Skip to main content
15,909,822 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem about opening file Pin
Hamid_RT13-Apr-07 18:37
Hamid_RT13-Apr-07 18:37 
GeneralRe: Problem about opening file Pin
Chen-XuNuo13-Apr-07 18:42
Chen-XuNuo13-Apr-07 18:42 
GeneralRe: Problem about opening file [modified] Pin
Dosin13-Apr-07 18:53
Dosin13-Apr-07 18:53 
GeneralRe: Problem about opening file Pin
Chen-XuNuo14-Apr-07 1:49
Chen-XuNuo14-Apr-07 1:49 
GeneralRe: Problem about opening file Pin
Hamid_RT14-Apr-07 6:11
Hamid_RT14-Apr-07 6:11 
Questionmesh_model.x DirectX 9.0 c++ Pin
Dosin13-Apr-07 15:57
Dosin13-Apr-07 15:57 
QuestionNewbie: How do I make a progress dialog? Pin
maxmaven13-Apr-07 13:26
maxmaven13-Apr-07 13:26 
AnswerRe: Newbie: How do I make a progress dialog? Pin
bob1697213-Apr-07 16:12
bob1697213-Apr-07 16:12 
Most peoples gut reaction to progress bars is something like this...

m_wndProgress.SetRange32(0,500);
m_wndProgress.SetPos(0);

for (int i=0;i<500;++i) {

Sleep(50); // Just to slow this down for demo

/*
do work here
*/

m_wndProgress.SetPos(i);
}

However, if you drop this code into a button click handler in a dialog with a progress bar, you'll notice the dialog becomes unresponsive to any user actions such as closing the dialog.

If processing your work takes enough time to require a progress bar, then it probably should allow the user to cancel or abort the activity. The easiest way to perform some lengthy processing while leaving the GUI thread free to respond to the user is to perform the processing in a separate worker thread. The worker thread then can post messages to the GUI thread to allow it to update the progress bar. This allows the GUI's message loop to process in a normal fashion. When we had the GUI thread performing the work as in the snippet above, message processing for the dialog had to wait for the loop to finish. Unresponsive GUI's are a good recipe for short tempers.

Look up AfxBeginThread() for MFC threading

Not quite pseudocode but I hope it helps get the wheels turning.

AnswerRe: Newbie: How do I make a progress dialog? Pin
PJ Arends13-Apr-07 16:34
professionalPJ Arends13-Apr-07 16:34 
QuestionOnKeyDown() ignored? Pin
aquawicket13-Apr-07 12:16
aquawicket13-Apr-07 12:16 
AnswerRe: OnKeyDown() ignored? Pin
Mark Salsbery13-Apr-07 12:22
Mark Salsbery13-Apr-07 12:22 
GeneralRe: OnKeyDown() ignored? Pin
aquawicket13-Apr-07 12:36
aquawicket13-Apr-07 12:36 
GeneralRe: OnKeyDown() ignored? Pin
Mark Salsbery13-Apr-07 12:41
Mark Salsbery13-Apr-07 12:41 
GeneralRe: OnKeyDown() ignored? Pin
aquawicket13-Apr-07 12:54
aquawicket13-Apr-07 12:54 
GeneralRe: OnKeyDown() ignored? Pin
aquawicket13-Apr-07 12:55
aquawicket13-Apr-07 12:55 
GeneralRe: OnKeyDown() ignored? Pin
aquawicket18-Apr-07 6:00
aquawicket18-Apr-07 6:00 
QuestionIs there any way to convert MFC application to C# app? Pin
oleg6313-Apr-07 12:12
professionaloleg6313-Apr-07 12:12 
AnswerRe: Is there any way to convert MFC application to C# app? Pin
Mark Salsbery13-Apr-07 12:39
Mark Salsbery13-Apr-07 12:39 
QuestionFirst Chance exception Pin
namratab13-Apr-07 11:10
namratab13-Apr-07 11:10 
AnswerRe: First Chance exception Pin
bob1697214-Apr-07 7:55
bob1697214-Apr-07 7:55 
QuestionDestructor Not Getting Called Pin
CoffeeAddict1913-Apr-07 11:09
CoffeeAddict1913-Apr-07 11:09 
QuestionRe: Destructor Not Getting Called Pin
Mark Salsbery13-Apr-07 11:23
Mark Salsbery13-Apr-07 11:23 
AnswerRe: Destructor Not Getting Called Pin
CoffeeAddict1913-Apr-07 11:32
CoffeeAddict1913-Apr-07 11:32 
GeneralRe: Destructor Not Getting Called Pin
Mark Salsbery13-Apr-07 11:36
Mark Salsbery13-Apr-07 11:36 
GeneralRe: Destructor Not Getting Called Pin
CoffeeAddict1913-Apr-07 11:48
CoffeeAddict1913-Apr-07 11:48 

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.