calling a function after a delay
Hello all, it's my first post on this forum.
I was wondering what is the best way to get an event to occur after a delay in Visual C++. Previously I have been using python and it's pretty easy to do there, using a command such as frame.after(X, myFunction) which would call myFunction after X milliseconds. What's the best way to do it in VC++?
I've heard about the sleep function but I don't think that will work as the program I'm trying to write will need to be carrying on doing other stuff during the interval.
Let's say, for a simple example, I want to write a program that basically counts to ten, so it prints "1" after 1 second, "2" after 2 seconds and so on. But I will need the program to remain "awake" during the delay, as there will also be a button on the screen that can be clicked on, which will result in "Response Made" whenever that happens, so if it is clicked in between 1 and 2 seconds I need to make sure the program is not sleeping.
If anyone can give me any advice I'd be grateful! Thanks.