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;
}

Recommended Answers

All 2 Replies

>>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().

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.