0

how can I sleep my program without sleeping others (or making them slower)?
I am using a windows application. here is a fragment of my code:

//#includes...
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, char * cmdParam, int cmdShow)
{
	MSG  msg;
	int status;
	Window myWind(SW_SHOW,"Name",150,120,500,0);
	for(int i=0;i<550;i++){
		myWind.setLocation(i,i);
		//here is my problem
		//is there another way (like a thread)?
		Sleep(100);
	}
	while ((status = GetMessage (& msg, 0, 0, 0)) != 0)
	{
		if (status == -1)
		{
			return -1;
		}
		DispatchMessage (& msg);
	}
	return msg.wParam;
}
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by teo236
0

>>how can I sleep my program without sleeping others (or making them slower)?

You can't make other programs sleep... What are you talking about, what are "the others". The Sleep function is perfectly ok, it "Suspends the execution of the current thread until the time-out interval elapses." - msdn. What else do you want? If your other threads are seem to go to sleep, then it's a problem with those threads, not with the use of Sleep().

0

im using windows 7 and every time I run my program every program gets slower than normal(very). if I click another window while my program is running my program stops responding.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.