I click on a button and a popup(style) dialog appears. I then call a runmodalloop function which recieves a certain amount of data and after it finishes the main window refreshes and shows the data. What i would like to do is, have access to the main window while the runmodallloop is active ( dialog runs in the background). I tried with starting a new thread, and putting the function in it but it won't give me access. Afterwards i made the dialog as a child and set the main wnd as the parent.And after the child finished with the modal loop the program frooze.