   CProgressCtrl question
  I have a SingleDoc MFC app. Now I want to make a dialog window with a progressbar to track the initialisation state of the app. However for the bar to change realtime i''d have to put the initialisation code in the Dialog objekt and thats ugly. How could I best do this?-CProgrammer  
  Callbacks? It''s really hard to tell with the little information you are giving. ;  Well basically the problem is that calling DoModal() for a CDialog stops the code and enters the CDialog objects code. I however want to open the menu, let the code continue running after DoModal and let the code give commands like setprogress or so.-CProgrammer ;  I think Multithreading could be a solution to your answer...Look at stuff like semaphores and mutexes (I have no idea what they are) but I heard they were good for keep volitaile code safe from tampering from outside threads.Of course, that''s one solution. Elegant solution, hard to implement. I suggest you just "hack" it (not really hacking per se, but in a "clean" way), its what I would do ;  Multithreading sounds like a good idea. So basically I start a new thread for the Dialog box. Do you have any pointers on where to begin what functions, because i have no experience with MultiThreading.-CProgrammer ;  Would AfxBeginThread be a good choice?Oh and isnt it dangerous to have two threads access one object in this case the CDialog derived object?-CProgrammer   [edited by - CProgrammer on February 13, 2004 1:57:07 AM];  not so much dangerous as can lead to tricky to track down problems, which is where mutexes come in.When you access a varible which is going to be shared between two bits of code you first of all ''lock'' it by using a mutexe, this prevents any other thread from accessing the data as you use it, one you are done with it you release your lock and continue, leaving other threads free to lock the object themselves and work with it.Thats a reasonbly quick over view, i would suguest you look them up, as you are using MFC MSDN would be a good place to start, i recall reading some stuff about mutexes and threading on there about a year ago which cleared it up for meAfxBeginThread would be the function of choice for an MFC thread, yes ;  Hello there CProgrammer,I don''t think that using threads is the right way to go on this...It can be done that way - but I think there''s an easier way.Just lookup non-modal windows/dialogs to learn more on the subject, plus take a look at this.I think that''s what you''re looking for.Here are couple of great sites for MFC related (and other) stuff:Code ProjectCode Guru;  Thanks for the help.-CProgrammer ;  hi NE1,Thanks for the tips, non-modal windows sounds much better.I'll check out your link.EDIT: Ah this is exactly what I need. Thanks-CProgrammer   [edited by - CProgrammer on February 13, 2004 2:20:09 AM]