Getting object to drag when mouse clicked and moved

I have been working on this program for one of my classes and I'm currently stuck. My program is 90% working, minus the mouse move command, when I click down on the mouse I should be able move the ellipse with the mouse while clicking down still, the cursor should turn to a hand and drag the ellipse drawn before. Here is the code im having a problem with, but I don't know if its something to do with my paint function or something im missing in mousemove case. If anyone can tell me what's wrong or give me ideas on how to fix this that would be great.

case WM_MOVE:
y =HIWORD(lParam);

Last edited on
Your code is rather involved, so it's pretty hard to follow when unformatted. Please go back and edit your post to use code tags.

But (a) you do not need the call to ValidateRect as BeginPaint validates the region for you (ValidateRect is more to "cancel invalidation", usually after painting directly on the window outside of the WM_PAINT handler), and (b) you have loads of unnecessary statics. Only something that need to exist between function calls should be static (and unless you're coding C89, I would tighten up the scope of you variables as tightly as possible.)

But until you've formatted your code, I can say anything more as it's too much effort to follow unformatted code.



How to use code tags
Last edited on
The only glue ive gotten for this is to get the center of the ellipse from mouse move, but I cant quite seem to get that to work, so if anyone can help me to make this work it would be much appreciated.

Yea check above
Topic archived. No new replies allowed.