-
Sleep or Idle
I kinda started this in another thread but I think I better start my own instead of hijacking someone elses thread
Well..I will do my best to explain what I try to achive. I have a SDI app that is supposed to be a CAD/CAM prog. I have designed a class for getting locations from the drawing area like endpoints,centerpoints, midpoints on lines and arcs.. I want to be able to call a function in my custom class that returns XYZ coordinates. I also want to use OnMouseMove() in my custom class. But if I call the function in my class like this. m_MyClass.XYZFunction I don't get a chance to use the OnMouseMove in MyClass because XYZFunction returns right away. I could just do a forever loop but I also have some processing going on with my MyClass::OnMouseMove function so if I start spinning a loop that will take all the CPU power. So I rather use a Sleep or some sort of idle to stop XYZFunction to end before a condition in MyClass::OnMouseMove is satisfed. Did this make sense? I hope it did
~Barjor
-
What I could do is to do a forever loop with a Sleep(50) in it wich would be easy on the CPU and still stop the XYZFunction from returning until some condition is meet. But thats not a pretty solution
-
>>> Did this make sense?
No. Try again, leave out the details, just the concept.
-
Barjor
I got it to work last night without any Sleep or other cludges. I looked in my Petzold and found some cool real time calls for Lbutton down(::KeyAsyncsomething something(VK_LBUTTON)) that is negative when L mouse button is clicked and it doesn't wait for the message loop. Thanks for the interest and you where right when you said my first design was flawed. Isn' it funny how things that sounds perfectly clear when you explain something sounds like latin for people that haven't worked on your project for a year.
~Barjor