The idea of the Sleep() function is to cause the program to pause a moment, then resume the program. As I already know, the parameter of the Sleep function is the milliseconds that the program is suppose to pause for. What I'm having problems with is it's appropiate use. Let me give you an example. A function assigns a value to a CString variable such as this:
CString theVariable;
void MyProgram::Assign()
{
theVariable = "Hello World"
UpdateData(FALSE);
etc, etc, etc.
}
Thus, assuming that theVariable is assigned to an edit box, the words 'Hello World' would appear in the box. The problem I'm having is this:
CString theVariable;
void MyProgram::Assign()
{
theVariable = "Hello World"
UpdateData(FALSE);
Sleep(5000);
etc, etc, etc.
}
In this example, even though the Sleep command comes after UpdateData(FALSE), the program will still wait 5 seconds before printing the 'Hello World' in the edit box. What I'm wanting is to print 'Hello World' in the edit box and then wait 5 seconds, then continue with other commands in the program. Am I doing something wrong? I must be. Is there an easier way to accomplish the same thing? Any help in this matter would be appreciated.
Thanks
Nyjil
CString theVariable;
void MyProgram::Assign()
{
theVariable = "Hello World"
UpdateData(FALSE);
etc, etc, etc.
}
Thus, assuming that theVariable is assigned to an edit box, the words 'Hello World' would appear in the box. The problem I'm having is this:
CString theVariable;
void MyProgram::Assign()
{
theVariable = "Hello World"
UpdateData(FALSE);
Sleep(5000);
etc, etc, etc.
}
In this example, even though the Sleep command comes after UpdateData(FALSE), the program will still wait 5 seconds before printing the 'Hello World' in the edit box. What I'm wanting is to print 'Hello World' in the edit box and then wait 5 seconds, then continue with other commands in the program. Am I doing something wrong? I must be. Is there an easier way to accomplish the same thing? Any help in this matter would be appreciated.
Thanks
Nyjil