Wm_timer

This is a discussion on Wm_timer within the Windows Programming forums, part of the Platform Specific Boards category; Ok first, to do all this i saw that you had to create and add the Code: ClientResize(hWnd, rect.right, rect.bottom) ...

  1. #16
    Registered User
    Join Date
    Dec 2007
    Posts
    796
    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.
    Compiler MSVC++ 2013 with Code::Blocks.

  2. #17
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    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
    796
    True, its much easier that way.

    I didnt think that we could change the RECT values in WM_SIZE too.
    Compiler MSVC++ 2013 with Code::Blocks.

  4. #19
    Registered User
    Join Date
    Dec 2007
    Posts
    796
    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?
    Compiler MSVC++ 2013 with Code::Blocks.

  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
    796
    Cool, thanks manuell!
    Compiler MSVC++ 2013 with Code::Blocks.

  7. #22
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    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

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21