Thread: Wm_timer

  1. #16
    Registered User
    Join Date
    Dec 2007
    Posts
    930
    Ok first, to do all this i saw that you had to create and add the
    Code:
    ClientResize(hWnd, rect.right, rect.bottom)
    function.
    I never would have found it out by myself and i never thought it would be that complicated to resize a program. Ive learned a big deal thanks to you!

    Secondly to adjust the buffering to keep the ellipse totally in the client window i just adjusted the ellipse coordinates by the growth value checked in WM_TIMER

    Code:
     if (growth > 50 || growth < 0)
    I hope this is what you meant.

    Code:
    Ellipse(biop->Get_DC_Buffer(0), (left/2) + growth, ((top/2)+50) - growth, right - growth, (bottom-50) + growth);
    Last edited by Ducky; 09-20-2008 at 08:25 AM.
    Using Windows 10 with Code Blocks and MingW.

  2. #17
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    I was thinking more along the lines of:

    Code:
    case WM_SIZE:
    	  GetClientRect(hWnd,&rect);
    	  
    	 biop->ReInitialize_BufferRECT(hWnd,1);
    	 biop->Free_Buffer(0);
             biop->Create_Buffer(0);//(B) 
    	 left = rect.left;
    	 top = rect.top + 50;	 
             right = rect.right ;
    	 bottom = rect.bottom - 50 ;	 
             ClientResize(hWnd, rect.right,  rect.bottom);
    	break;
    as opposed to:

    Code:
    Ellipse(biop->Get_DC_Buffer(0), (left/2) + growth, ((top/2)+50) - growth, right - growth, (bottom-50) + growth);

  3. #18
    Registered User
    Join Date
    Dec 2007
    Posts
    930
    True, its much easier that way.

    I didnt think that we could change the RECT values in WM_SIZE too.
    Using Windows 10 with Code Blocks and MingW.

  4. #19
    Registered User
    Join Date
    Dec 2007
    Posts
    930
    Ok now i understand how double buffering is working but i dont see how could this help me to
    solve my original problem. That is to call 2 SetTimer functions with 2 different intervales.

    Even using double buffering wont change the fact that it will invalidate the whole client area everytime the functions are called.

    What i would need is a function to invalidate and repaint only a certain space in the client area.

    I dont know if its possible in GDI or maybe i need DirectX for this?
    Using Windows 10 with Code Blocks and MingW.

  5. #20
    Registered User
    Join Date
    Sep 2008
    Location
    Near Paris
    Posts
    6
    Quote Originally Posted by Ducky View Post
    What i would need is a function to invalidate and repaint only a certain space in the client area.
    See InvalidateRect, second parameter (lpRect)
    http://msdn.microsoft.com/en-us/library/ms534893.aspx

  6. #21
    Registered User
    Join Date
    Dec 2007
    Posts
    930
    Cool, thanks manuell!
    Using Windows 10 with Code Blocks and MingW.

  7. #22
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Follow the InvalidateRect() with an UpdateWindow(), is faster.
    "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