|
-
Feb 6th, 2002, 05:47 AM
#1
Thread Starter
Fanatic Member
Help!!!
I am quite new with Visual C++. I know C++ pretty good. I am starting to write small programs in VC++ , at the moment Win32 application to draw lines with mouse movements.
Ok..now the problem..
I wrote a small program that draws lines on mousedown and mouseup. ie. It captures the mouse co-ordinates in WM_LBUTTONDOWN , saves it to two variables, and in WM_LBUTTONDOWN captures the mouse co-ordinates and draw a line btn these two points. But it always draw the line from top left of the window to the current point. Can u please help me ? Here is my code.
case WM_LBUTTONDOWN:
POINTS p;
p=MAKEPOINTS(lParam);
xPos=p.x;
yPos=p.y;
break;
case WM_LBUTTONUP:
p=MAKEPOINTS(lParam);
MoveToEx(GetDC(hWnd),p.x,p.y,NULL);
LineTo(GetDC(hWnd),p.x+10,p.y+10);
break;
xPos and yPos I declared as global variables. where is my mistake?
Faisal Muhammed
Homepage:I Started making it in 1994 ...Still Under Construction  
Using
Visual Basic 6.0 Enterprise SP5
Embedded Visual Basic 3.0
SQL Server 2000
Windows 2000 Proff
Delphi 6.0
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|