Run 2 function at the same time

Hi, I have a problem here. I want to make a program where when I click button it appear a new window and run a function at the same time. But when I write like this, I have to close the window then the scan() function run. How can I make it run at the same time? Thank you.

1
2
3
4
5
6
  if (LOWORD(wParam) == 4) {
              int WINAPI Window2();
              int window2 = Window2();
              int scan();
              int file = scan();  
	   }
Last edited on
You can do this with a modeless dialog.
http://www.winprog.org/tutorial/modeless_dialogs.html
Hi, I have take a look at the link given but still confuses me. Basically what is modeless dialog? I still dont understand much. Also, I found that if u want to run several functions at the same time, u can use THREAD or FUTURE. I've tried but it also doesnt work for me. Please help.

Basically in my code, I want to click a button 'scan' and appears a new window (Window2()) and at the same time start scanning (scan()).
Last edited on
A modal dialog is a dialog where the main app stop working while the dialog is open - like a message box. With a modeless dialog you can move it and continue working - like search and replace dialog in a word processor. A modeless dialog sound like a good idea for your project. It's much easier than using threads. What is this project about?
Thank u for the explanation. I will try.

Its about a simple dummy antivirus for my final year project. When I click button scan, it will start scanning files in local disk C. So I think it needed to show new window that stated 'scanning..' with a button to cancel scan.
Why do you need a second window?
You could do everything in the main window.
Topic archived. No new replies allowed.