Click here to Skip to main content
15,914,452 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionManage Timer on MFC [modified] Pin
CDRAIN17-Apr-07 23:36
CDRAIN17-Apr-07 23:36 
AnswerRe: Manage Timer on MFC Pin
Roger Stoltz18-Apr-07 6:19
Roger Stoltz18-Apr-07 6:19 
GeneralRe: Manage Timer on MFC Pin
CDRAIN19-Apr-07 1:12
CDRAIN19-Apr-07 1:12 
QuestionRe: Manage Timer on MFC Pin
Roger Stoltz19-Apr-07 1:48
Roger Stoltz19-Apr-07 1:48 
AnswerRe: Manage Timer on MFC [modified] Pin
CDRAIN19-Apr-07 2:45
CDRAIN19-Apr-07 2:45 
GeneralRe: Manage Timer on MFC Pin
Roger Stoltz19-Apr-07 4:23
Roger Stoltz19-Apr-07 4:23 
GeneralRe: Manage Timer on MFC Pin
CDRAIN19-Apr-07 23:34
CDRAIN19-Apr-07 23:34 
GeneralRe: Manage Timer on MFC Pin
Roger Stoltz23-Apr-07 23:53
Roger Stoltz23-Apr-07 23:53 
I'm afraid that this solution may be a little bit too complex.

You ask about accessing graphic components in the main window from the UI-thread and whether this is a problem or not. The answer is "it depends on how you do it". You cannot access the components directly since your call is made from another thread and the object map is per thread basis. What you do is post WM_COMMAND messages to the different UI objects in the main window.

I suggest that you revert to my alternative suggestion in my first post: spawn a thread that displays a dialog box with a progress bar prior to starting the lengthy operation from the main thread.
This will save you the trouble of marshalling, sending WM_COMMAND messages to graphic components of the main window etc.
Since it's not possible to implement the "best solution", i.e. refactor the ActiveX component and make it asynchronous, you don't have to make things more complex than necessary. It would be nice to have the ActiveX in another apartment as I suggested, but given your latest reply I realize that it's overly complicated.
The user won't see any difference and in either case he/she won't be able to cancel the lengthy operation, so there's no point in having a "Cancel"-button in the dialog.


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown

QuestionHow you size your views? Pin
baerten17-Apr-07 23:11
baerten17-Apr-07 23:11 
AnswerRe: How you size your views? Pin
Mark Salsbery18-Apr-07 6:28
Mark Salsbery18-Apr-07 6:28 
GeneralRe: How you size your views? Pin
baerten18-Apr-07 21:26
baerten18-Apr-07 21:26 
GeneralRe: How you size your views? Pin
Mark Salsbery19-Apr-07 8:07
Mark Salsbery19-Apr-07 8:07 
GeneralRe: How you size your views? Pin
baerten19-Apr-07 23:10
baerten19-Apr-07 23:10 
GeneralRe: How you size your views? Pin
Mark Salsbery20-Apr-07 7:26
Mark Salsbery20-Apr-07 7:26 
Question_splitpath Issue Pin
Programm3r17-Apr-07 22:54
Programm3r17-Apr-07 22:54 
AnswerRe: _splitpath Issue Pin
Cedric Moonen17-Apr-07 23:21
Cedric Moonen17-Apr-07 23:21 
GeneralRe: _splitpath Issue Pin
Programm3r18-Apr-07 0:49
Programm3r18-Apr-07 0:49 
QuestionWhere to create font and set it to owner drawn menu Pin
Atul2317-Apr-07 22:48
Atul2317-Apr-07 22:48 
AnswerRe: Where to create font and set it to owner drawn menu Pin
Hamid_RT18-Apr-07 1:41
Hamid_RT18-Apr-07 1:41 
Questioncolor of a button Pin
p_17-Apr-07 22:20
p_17-Apr-07 22:20 
AnswerRe: color of a button Pin
Hamid_RT17-Apr-07 22:22
Hamid_RT17-Apr-07 22:22 
GeneralRe: color of a button Pin
p_17-Apr-07 22:34
p_17-Apr-07 22:34 
GeneralRe: color of a button Pin
Hamid_RT18-Apr-07 1:28
Hamid_RT18-Apr-07 1:28 
GeneralRe: color of a button Pin
Hamid_RT18-Apr-07 1:32
Hamid_RT18-Apr-07 1:32 
GeneralRe: color of a button Pin
Mark Salsbery18-Apr-07 6:29
Mark Salsbery18-Apr-07 6:29 

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.