this really weird thing is happening when i try to find my mouse position of my window.
If i put it to the top left of the window it is fine but as it goes further down and across it goes weird. It is really hard to explain, but is this right how you find the mouse position relative to my window?

case WM_LBUTTONDOWN:
 
{ 
           float mx = 0;//mousex
           float my = 0;//mousey
           mx = LOWORD(lParam);
           my = HIWORD(lParam);
           return (0);
}

Try adding this:

case WM_LBUTTONDOWN:
{ 
   float mx = 0;//mousex
   float my = 0;//mousey
   mx = LOWORD(lParam);
   my = HIWORD(lParam);
   [B]POINT mp;
   mp.x = mx;
   mp.y = my;
   ScreenToClient(hwnd, &mp);
   mx = mp.x;
   my = mp.y;[/B]
   return (0);
}

For more information look here.

edit: I just realised this might not be what your looking for ;)

sorry that doesn't work. I am trying to draw a line from where my mouse is when i click to where it is when i let go, if that helps. if i do it at 0,0 its fine but as i go further across and down the line isn't where my mouse is any more, it gets further and further away :(

sorry that doesn't work. I am trying to draw a line from where my mouse is when i click to where it is when i let go, if that helps. if i do it at 0,0 its fine but as i go further across and down the line isn't where my mouse is any more, it gets further and further away :(

You might post the code.

i did. thats all i am using to find the mouse position. Is it completely right? :O

i did. thats all i am using to find the mouse position. Is it completely right? :O

You might change it to

int xPos = GET_X_LPARAM(lParam); 
int yPos = GET_Y_LPARAM(lParam);

although that probably won't fix anything. Anyway, I meant that you might perhaps post the complete code you have for drawing the line.

I fixed it by going mousex = mousex * 0.8 and mousey = mousey * 1.45;
this is quite accurate, but it is quite strange that i had to do it. Thanks for help.

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.