Thread: Drawing with mouse

  1. #1
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    715

    Drawing with mouse

    Hi, I have another problem.
    I wrote program that enebles user to draw with mouse.
    Here's the code:

    Code:
    #include <windows.h>
    
    
    LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
    
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        PSTR szCmdLine, int iCmdShow)
    {
         static TCHAR szAppName[] = TEXT ("Connect") ;
         HWND         hwnd ;
         MSG          msg ;
         WNDCLASS     wndclass ;
         
         wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
         wndclass.lpfnWndProc   = WndProc ;
         wndclass.cbClsExtra    = 0 ;
         wndclass.cbWndExtra    = 0 ;
         wndclass.hInstance     = hInstance ;
         wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
         wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
         wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
         wndclass.lpszMenuName  = NULL ;
         wndclass.lpszClassName = szAppName ;
         
         if (!RegisterClass (&wndclass))
         {
              MessageBox (NULL, TEXT ("Program requires Windows NT!"), 
                          szAppName, MB_ICONERROR) ;
              return 0 ;
         }
         
         hwnd = CreateWindow (szAppName, TEXT ("Connect-the-Points Mouse Demo"),
                              WS_OVERLAPPEDWINDOW,
                              CW_USEDEFAULT, CW_USEDEFAULT,
                              CW_USEDEFAULT, CW_USEDEFAULT,
                              NULL, NULL, hInstance, NULL) ;
         
         ShowWindow (hwnd, iCmdShow) ;
         UpdateWindow (hwnd) ;
         
         while (GetMessage (&msg, NULL, 0, 0))
         {
              TranslateMessage (&msg) ;
              DispatchMessage (&msg) ;
         }
    
    return (int)msg.wParam ;
    }
    
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    
    	static int iCount,iPrevX,iPrevY;
    	HDC hdc;
    	PAINTSTRUCT ps;
    	RECT rect;
    
    	switch(message)
    	{
    	case WM_LBUTTONDOWN:
    		iCount=0;
    		iPrevX=LOWORD(lParam);
    		iPrevY=HIWORD(lParam);
    		return 0;
    	case WM_MOUSEMOVE:
    		if(wParam & MK_LBUTTON)
    		{
    			hdc=GetDC(hwnd);
    			MoveToEx(hdc,iPrevX,iPrevY,NULL);
    			LineTo(hdc,LOWORD (lParam), HIWORD (lParam));
    			iPrevX=LOWORD (lParam);
    			iPrevY=HIWORD (lParam);	
    			ReleaseDC(hwnd,hdc);
    		}
    		return 0;
    	case WM_LBUTTONUP:
             InvalidateRect (hwnd, NULL, FALSE) ;
             return 0 ;
    
    	case WM_PAINT:
    		GetClientRect(hwnd,&rect);
    		hdc=BeginPaint(hwnd,&ps);
    		InvalidateRect(hwnd,&rect,FALSE);
    		EndPaint(hwnd,&ps);
    		return 0;
                   
         case WM_DESTROY:
              PostQuitMessage (0) ;
              return 0 ;
         }
         return DefWindowProc (hwnd, message, wParam, lParam) ;
    
    }
    Everything works fine, but when I resize windows or minimize it everything is erased. I know this is probably because of WM_PAINT because this message is sent every time window is resized. How to prevent contents of window being erased. Is there any function that disable save what was before nad then restor it?
    I tried with InvalidateRect, but no success.
    Then you very much for your help!

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Just do all your painting in WM_PAINT. Don't do it in WM_MOUSEMOVE.

  3. #3
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    715
    Well, I know where problem is and why it is happening but don't know how to fix it. I cannot write something like this:
    Code:
    case WM_MOUSEMOVE:
    	case WM_PAINT:	
    		
    		if(wParam & MK_LBUTTON)
    		{
    			hdc=GetDC(hwnd);
    			MoveToEx(hdc,iPrevX,iPrevY,NULL);
    			LineTo(hdc,LOWORD (lParam), HIWORD (lParam));
    			iPrevX=LOWORD (lParam);
    			iPrevY=HIWORD (lParam);	
    			ReleaseDC(hwnd,hdc);
    		}
    		return 0;
    It simply not working because when WM_PAINT is sent if (...) is false and narea cannot be redrawn.
    If you can help me with this particular problem I would greatly appreciate it. Thanks

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    InvalidateRect() sends a paint message. You CAN'T use it in WM_PAINT. ie endless loop

    Follow InvalidateRect() with a UpdateWindow() to force a redraw and bypass the message que.

    >>Is there any function that disable save what was before nad then restor it?

    SaveDC() may work but I doubt it. I think you will need a 'frame buffer'. Your own copy of a HDC and its bitmap. Draw to this then BitBlit() to the HDC returned from BeginPaint()

    I have posted much code on this so try a search.

    CreateCompatibleDC()
    CreateCompatibleBitmap()
    ReleaseDC()
    DeleteObject()

    Unless using the .NET versions of MSVC be very careful not to create a GDI leak.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    715
    I tried to do something and it is slight better because my plot stays when moving window. It clears when resizing it
    Here's code:
    Code:
    #include <windows.h>
    
    
    LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
    
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        PSTR szCmdLine, int iCmdShow)
    {
         static TCHAR szAppName[] = TEXT ("Connect") ;
         HWND         hwnd ;
         MSG          msg ;
         WNDCLASS     wndclass ;
         
         wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
         wndclass.lpfnWndProc   = WndProc ;
         wndclass.cbClsExtra    = 0 ;
         wndclass.cbWndExtra    = 0 ;
         wndclass.hInstance     = hInstance ;
         wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
         wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
         wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
         wndclass.lpszMenuName  = NULL ;
         wndclass.lpszClassName = szAppName ;
         
         if (!RegisterClass (&wndclass))
         {
              MessageBox (NULL, TEXT ("Program requires Windows NT!"), 
                          szAppName, MB_ICONERROR) ;
              return 0 ;
         }
         
         hwnd = CreateWindow (szAppName, TEXT ("Connect-the-Points Mouse Demo"),
                             WS_OVERLAPPEDWINDOW,
                              CW_USEDEFAULT, CW_USEDEFAULT,
                              CW_USEDEFAULT, CW_USEDEFAULT,
                              NULL, NULL, hInstance, NULL) ;
         
         ShowWindow (hwnd, iCmdShow) ;
         UpdateWindow (hwnd) ;
         
         while (GetMessage (&msg, NULL, 0, 0)>0)
         {
              TranslateMessage (&msg) ;
              DispatchMessage (&msg) ;
         }
    
    return (int)msg.wParam ;
    }
    
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    
    	static int iCount,iPrevX,iPrevY;
    	HDC hdc, hdcMem;
    	static HBITMAP hBitmap ;
        PAINTSTRUCT    ps;
    	BITMAP         bitmap ;
    
    
    
    	switch(message)
    	{
    
    	case WM_LBUTTONDOWN:
    		iCount=0;
    		iPrevX=LOWORD(lParam);
    		iPrevY=HIWORD(lParam);
    		return 0;
    
    	case WM_LBUTTONUP:
             InvalidateRect (hwnd, NULL, FALSE) ;
             return 0 ;
    	case WM_MOUSEMOVE:
    		if(wParam & MK_LBUTTON)
    		{
    			hdc=GetDC(hwnd);
    			MoveToEx(hdc,iPrevX,iPrevY,NULL);
    			LineTo(hdc,LOWORD (lParam), HIWORD (lParam));
    			iPrevX=LOWORD (lParam);
    			iPrevY=HIWORD (lParam);	
    			ReleaseDC(hwnd,hdc);
    		}
    		return 0;
    	case WM_PAINT:
    		hdc = BeginPaint (hwnd, &ps) ;
    		GetObject (hBitmap, sizeof (BITMAP), &bitmap) ;
            hdcMem = CreateCompatibleDC (hdc);
            SelectObject (hdcMem, hBitmap);
    
           BitBlt(hdcMem, 
                   0,0, 
                   bitmap.bmWidth, bitmap.bmHeight, 
                   hdc, 
                   0,0, 
                   SRCCOPY);
              DeleteDC (hdcMem) ;
              EndPaint (hwnd, &ps) ;
    		  return 0;
                   
         case WM_DESTROY:
              DeleteObject (hBitmap);
              PostQuitMessage (0);
              return 0 ;
         }
         return DefWindowProc (hwnd, message, wParam, lParam) ;
    
    }
    If you can modify this code it would help me a lot, I think I'm on the right track, but still...
    Thanks

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You have to becareful of GDI objects. You can stop the PC being able to redraw its screen properly very quickly.

    I would

    On create / init

    get your window/dlg's DC
    create a compatible DC
    create a compatible bitmap to your window/dlg's DC and its client area
    select the bitmap into the created DC (catching the original bitmap to return on close)
    ie in C
    hSysBitmap=SelectObject(hdcScreen......
    (make these three items global or static if in the callback)

    Fill with a colour in case it has random data in it
    ie in C
    FillRect( hdcScreen, &ClientRect, GetStockObject(GRAY_BRUSH) );


    Release your window/dlg's DC

    On close

    Select the original bitmap back into the created DC
    Delete both the bitmap and the DC
    (a bitmap can not be deleted while in a DC and a DC must be returned to its original state to delete properly)

    On mouse move
    draw to your DC
    Call InvalidateRect to set the redraw area to the client
    call UpdateWindow() to bypass the message que and speed up the drawing

    On paint
    get the DC from BeginPaint()
    BitBlit() using the PAINTSTRUCTS rect param and your compatible DC
    end paint

    For speedy drawing and flicker free updates use a frame buffer system and return true to WM_ERASEBKGND msgs.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    715
    Thanks for replying novacain. I followed your advices as best as I can and here's code:
    Code:
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    
    	static int iPrevX,iPrevY,cxClient,cyClient;
    	static HDC hdc, hdcMem;
    	static HBITMAP hBitmap ;
        PAINTSTRUCT    ps;
    	RECT rect;
    
    
    
    	switch(message)
    	{
    	case WM_CREATE:
    		hdc=GetDC(hwnd);
    		hdcMem=CreateCompatibleDC(hdc);
    		hBitmap=CreateCompatibleBitmap(hdc,GetSystemMetrics(SM_CXMAXIMIZED),GetSystemMetrics(SM_CYMAXIMIZED));
    		SelectObject(hdcMem,hBitmap);
    		GetClientRect(hwnd,&rect);
    		FillRect( hdc, &rect, GetStockObject(GRAY_BRUSH) );
    		ReleaseDC(hwnd,hdc);
    		return 0;
    	case WM_SIZE:
    		cxClient=LOWORD(lParam);
    		cyClient=HIWORD(lParam);
    		return 0;
    	case WM_LBUTTONDOWN:
    		iPrevX=LOWORD(lParam);
    		iPrevY=HIWORD(lParam);
    		return 0;
    	case WM_MOUSEMOVE:
    		if(wParam & MK_LBUTTON)
    		{
    			hdc=GetDC(hwnd);
    			MoveToEx(hdc,iPrevX,iPrevY,NULL);
    			LineTo(hdc,LOWORD (lParam), HIWORD (lParam));
    			MoveToEx(hdcMem,iPrevX,iPrevY,NULL);
    			LineTo(hdcMem,LOWORD (lParam), HIWORD (lParam));
    			iPrevX=LOWORD (lParam);
    			iPrevY=HIWORD (lParam);	
    			InvalidateRect(hwnd,&rect,TRUE);
    			UpdateWindow(hwnd);
    			ReleaseDC(hwnd,hdc);
    		}
    		return 0;
    	case WM_PAINT:
    		hdc = BeginPaint (hwnd, &ps);
    		 BitBlt(hdcMem,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom,hdc,0,0,SRCCOPY);
              EndPaint (hwnd, &ps) ;
    		  return 0;
                   
         case WM_DESTROY:
    		 SelectObject(hdcMem,hBitmap);
              DeleteObject (hBitmap);
    		  DeleteObject(hdcMem);
              PostQuitMessage (0);
              return 0 ;
         }
         return DefWindowProc (hwnd, message, wParam, lParam) ;
    
    }
    But problem still exists! I really don't know what I'm doing worong. If you can point on specific line(s) in code and say hey kiddo this is wrong it should be...

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Close. Good you created the bitmap the largest it could be on the screen.

    On Mouse Move
    Use the hdcMem on the mouse move, not one you 'get'. You don't need to create a hdc here.

    On Paint
    use the hdcMem as the 'source' hdc and draw to the hdc from BeginPaint.
    Check your size paramaters, never assume the rect starts at 0. What happens if the user moves a message box across your window from the bottom right to the top left? (paint msgs can be generated outside your app)

    On Init
    You need a static HBITMAP for the original bitmap in your created hdc (hdcMem)
    ie
    hBMPOrig=SelectObject(hdcMem,hBitmap);

    On Close
    Select the original back into the hdcMem so it will delete properly. You won't see any benifit as Windows will (hopefully) clean up the lost GDI resources as your app closes but it is good practice. Under .NET GDI resources are less important as the are better managed, under WIN32 it is up to you.

    SelectObject(hdcMem,hBMPOrig);
    DeleteObject(hBitmap);
    DeleteDC(hdcMem);


    On size
    I would start by locking the size, remove the resize style from the window.

    Here you have to decide what the user will see. Do you want to scale the current drawing to the new size?
    try;
    Create a new hdc and bmp as you have on init.
    Copy the hdcMem to the temp hdc with a BitBlt (save the drawing)
    Clear the hdcMem (fill with a colour to cover up the drawing)
    Resize the image on the hdcMem;
    Use StretchBlt() from the temp hdc to the hdc mem using the new size the user has chosen for the destination and the old size for the source.
    Clean up the temp hdc and bitmap as per above.

    Have a look at SetCapture() , watch out when debugging though.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  9. #9
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    715
    Thanks for posting novacain, but unfortunately (for me) I didn't managed to get this work. Now I'm getting a complete Black screen. Anyway I think I should give up, windows programming is not my stronger side
    Thanks

  10. #10
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    715

    Unhappy

    Even after more than two weeks I'm not able to manage to get this work. My newest try:
    Code:
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    
    	static int iPrevX,iPrevY,cxClient,cyClient;
    	static HBITMAP hBitmap;
    	static HDC hdcMem,hdc;
    	PAINTSTRUCT ps;
    	switch(message)
    	{
    	case WM_CREATE:
    		hdc=GetDC(hwnd);
    		hdcMem=CreateCompatibleDC(hdc);
    		
    		return 0;
    	case WM_SIZE:
    		cxClient=LOWORD(lParam);
    		cyClient=HIWORD(lParam);
    		return 0;
    	case WM_LBUTTONDOWN:
    		iPrevX=LOWORD(lParam);
    		iPrevY=HIWORD(lParam);
    		return 0;
    	case WM_MOUSEMOVE:
    		if(wParam & MK_LBUTTON)
    		{
    			MoveToEx(hdc,iPrevX,iPrevY,NULL);
    			LineTo(hdc,LOWORD (lParam), HIWORD (lParam));
    			MoveToEx(hdcMem,iPrevX,iPrevY,NULL);
    			LineTo(hdcMem,LOWORD (lParam), HIWORD (lParam));
    			hBitmap=CreateCompatibleBitmap(hdcMem,GetSystemMetrics(SM_CXMAXIMIZED),GetSystemMetrics(SM_CYMAXIMIZED));
    			SelectObject(hdcMem,hBitmap);
    			iPrevX=LOWORD (lParam);
    			iPrevY=HIWORD (lParam);	
    		}
    		return 0;
    	case WM_PAINT:
    		BeginPaint (hwnd, &ps);
    		 BitBlt(hdc,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom,hdcMem,0,0,SRCCOPY);
              EndPaint (hwnd, &ps) ;
    		  return 0;
                   
         case WM_DESTROY:
              DeleteObject (hBitmap);
    		  DeleteObject(hdcMem);
    		  ReleaseDC(hwnd,hdc);
              PostQuitMessage (0);
              return 0 ;
         }
         return DefWindowProc (hwnd, message, wParam, lParam) ;
    
    }
    Please, if you can modify this code to get it work and then I'll understand. Explanations what should I do and when didn't help me much!
    Thanks in advance!
    Last edited by Micko; 10-01-2004 at 01:10 PM.

  11. #11
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Your 90% of the way there. You just have a bit of the code mixed up.

    The idea is:

    - Set up an offscreen bitmap and device context when the window is created.
    - When the mouse is moved, draw to the offscreen bitmap and tell windows to send a WM_PAINT message.
    - When we receive a WM_PAINT message, copy the offscreen bitmap to the provided device context.
    - When the window is destroyed, destroy our offscreen bitmap and device context. Note that a DC must be in its original state before it is destroyed.

    Take special note of the highlighted portions of the code.
    Code:
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	static int     iPrevX, iPrevY, cxClient, cyClient;
    	static HBITMAP hBitmap, hBitmapOld;
    	static HDC     hdcMem;
    
    	switch(message)
    	{
    	case WM_CREATE:
    	{
    		/* Set up our offscreen bitmap that we can draw on. */
    		HDC hdc = GetDC(hwnd);
    
    		hdcMem = CreateCompatibleDC(hdc);
    		hBitmap = CreateCompatibleBitmap(hdc, GetSystemMetrics(SM_CXMAXIMIZED), GetSystemMetrics(SM_CYMAXIMIZED));
    		hBitmapOld = SelectObject(hdcMem, hBitmap);
    
    		/* Paint the background of our offscreen bitmap gray. */
    		RECT rc;
    		SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXMAXIMIZED), GetSystemMetrics(SM_CYMAXIMIZED));
    		FillRect(hdcMem, &rc, (HBRUSH) GetStockObject(GRAY_BRUSH));
    
    		ReleaseDC(hwnd, hdc);
    
    		return 0;
    	}
    
    	case WM_SIZE:
    		cxClient = LOWORD(lParam);
    		cyClient = HIWORD(lParam);
    		return 0;
    
    	case WM_LBUTTONDOWN:
    		iPrevX = LOWORD(lParam);
    		iPrevY = HIWORD(lParam);
    		return 0;
    
    	case WM_MOUSEMOVE:
    		if(wParam & MK_LBUTTON)
    		{
    			/* Draw the line on our offscreen bitmap. */
    			MoveToEx(hdcMem, iPrevX, iPrevY, NULL);
    			LineTo(hdcMem, LOWORD(lParam), HIWORD(lParam));
    			iPrevX = LOWORD(lParam);
    			iPrevY = HIWORD(lParam);
    
    			/* Tell windows to send a WM_PAINT message. */
    			InvalidateRect(hwnd, NULL, FALSE);
    		}
    		return 0;
    
    	case WM_PAINT:
    	{
    		PAINTSTRUCT ps;
    
    		BeginPaint(hwnd, &ps);
    
    		/* Copy our offscreen bitmap to our paint dc. */
    		BitBlt(hdc,
    		       ps.rcPaint.left, /* x coordinate of upper left corner of destination. */
    		       ps.rcPaint.top,  /* y coordinate of upper left corner of destination. */
    		       ps.rcPaint.right - ps.rcPaint.left, /* Width. */
    		       ps.rcPaint.bottom - ps.rcPaint.top, /* Height. */
    		       hdcMem,
    		       ps.rcPaint.left, /* x coordinate of upper left corner of source. */,
    		       ps.rcPaint.top,  /* y coordinate of upper left corner of source. */
    		       SRCCOPY);
    
    		EndPaint(hwnd, &ps);
    		return 0;
    	}
                   
    	case WM_DESTROY:
    
    		/* Restore our DC to its original state. */
    		SelectObject(hdcMem, hBitmapOld);
    
    		/* Delete created bitmap and DC. */
    		DeleteObject(hBitmap);
    		DeleteObject(hdcMem);
    
    		PostQuitMessage(0);
    		return 0;
    	}
    
    	return DefWindowProc(hwnd, message, wParam, lParam);
    }
    Last edited by anonytmouse; 10-02-2004 at 09:24 PM.

  12. #12
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>Even after more than two weeks I'm not able to manage to get this work.<<

    the major attribute needed in programming (IMHO) is perserverence / determination, especially when the code refuses to run the way you want it to.

    Keep trying, keep posting if you need another hint.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  13. #13
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    Micko, regarding your private message, I believe it is best to reply on the forum (and I will apologize right now for not having read any of the posts so far):

    There is an MSDN page that explains the basic concepts:
    Drawing with the Mouse

    I hope this helps. I am sorry that I cannot put more time into this, I am extremely busy at the moment.

  14. #14
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Why not create a static linked list in the windowproc. Each node containing startx/y, stopx/y), update this in the WM_LBUTTONDOWN/WM_MOUSEMOVE, and repaint based on the coordinates in the list?

    Just a suggestion, i don't know if this is a bad siolution?

  15. #15
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>and repaint based on the coordinates in the list?

    You would have to re-scale /size the coods each new size message.

    Micko if you are still having problems post the code.

    Are you using GetLastError()?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help. Drawing program
    By Cherry65 in forum Windows Programming
    Replies: 4
    Last Post: 12-21-2008, 08:34 PM
  2. Drawing a user's mouse movements
    By John_L in forum C# Programming
    Replies: 0
    Last Post: 11-07-2007, 05:16 PM
  3. need Help in Mouse Pointer
    By obaid in forum C++ Programming
    Replies: 3
    Last Post: 12-07-2006, 03:33 AM
  4. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM
  5. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM