How to delay part of code

for example i have
1
2
3
4
5
6
int count = t1;
 while(count>counter){
Sleep(delay);
Int32::TryParse(textBox2->Text,add);
result = result + add;
	counter = counter + 1;

Problem is that sleep stops all program for specified time, Is there an alternative to sleep that would only stop part of code or can i use sleep different way to specify what it pauses?
If you want to do two things at once, you need to use threads. Is there any reason for your program to wait here?
Thanks i will start to learn about threads.
Reason is i am trying to learn.
Id like to see numbers changing depending on specified speed.
Problem is all counting gets done before values get updated on gui.
closed account (G26pX9L8)
As an alternative to threads, you could use some pause signal. Judging from your code your using the Windows libraries, and they do implement signals. Have a look at the Windows message loop.
closed account (10X9216C)
If you are doing some sort of Gui stuff and you want to gui to update to any changes. Usually there is some sort of run loop to let the library update itself in your code. Eg Qt has this http://qt-project.org/doc/qt-4.8/qcoreapplication.html#processEvents .
Thanks , i downloaded Qt soft and i like it more than visual c++ 2010 cli/c++.
Gui design interface appears very decent and hopefully code also is more easy to connect to gui items.
Do i understand right that Qt makes smaller files and reqires no .net to run?
You're right that it does not require .NET. I'm not sure about smaller files. That might depend on whether you statically link to Qt or dynamically link to Qt.
Would it be smart to start learning qt or are there better alternatives including gui design?
closed account (10X9216C)
You make it sound like learning a GUI library is this big endeavor, using GUI libraries are probably among the easiest to use. Although Qt provides tools that a lot of other GUI libraries skip on, such as an editor for positioning widgets. You would otherwise have to position elements by hand in code, setting coordinates which can be a pain in the ass.
Topic archived. No new replies allowed.