refresh the screen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • serge anton

    #1

    refresh the screen

    Hi,

    I want to refresh all the screen (including the desktop) or a part of the
    screen.
    I can have a reference to the screen with win32 API :

    [DllImport("user 32")]
    public static extern int GetWindowDC(Int Ptr hwnd);

    private void fct(){
    Graphics g = Graphics.FromHd c(new IntPtr(GetWindo wDC(IntPtr.Zero )));
    }

    But I don't know how to refresh the screen or a part of the screen

    Thanks to help me

    Serge



  • ppyrstr

    #2
    refresh the screen


    If memory serves you should be able to import
    InvalidateRect( HWND, NULL, TRUE). Sending null as the
    second parameter invalidates the entire window and true
    forces a re-paint. Another possible way might be to
    import and use UpdateWindow(HW ND) which does the same
    thing. I have never tried to use these on the entire
    desktop, but it seem that they should work.

    Comment

    • Peter Rilling

      #3
      Re: refresh the screen

      I don't have much experience with display manipulation, so bare with me.

      I would think that the OS would send the appropriate invalidate commands to
      the different applications. Also, you may not get an update immediately
      anyway since the message is queued by the application and if it is
      performance some intensive processing, the message loop may not be called.

      I guess the question is, why would you want to update the entire screen?

      "ppyrstr" <poopyrooster@h otmail.com> wrote in message
      news:057201c379 80$230571c0$a30 1280a@phx.gbl.. .[color=blue]
      >
      > If memory serves you should be able to import
      > InvalidateRect( HWND, NULL, TRUE). Sending null as the
      > second parameter invalidates the entire window and true
      > forces a re-paint. Another possible way might be to
      > import and use UpdateWindow(HW ND) which does the same
      > thing. I have never tried to use these on the entire
      > desktop, but it seem that they should work.[/color]


      Comment

      • Jeffrey Tan[MSFT]

        #4
        RE: refresh the screen


        Hi serge,

        You can do something like this:
        [DllImport("user 32.dll")]
        public static extern bool InvalidateRect( IntPtr hwnd,IntPtr lpRect,bool
        bErase);

        private void button1_Click(o bject sender, System.EventArg s e)
        {
        InvalidateRect( IntPtr.Zero ,IntPtr.Zero ,true);
        }

        Hope this helps

        Best regards,
        Jeffrey Tan
        Microsoft Online Partner Support
        Get Secure! - www.microsoft.com/security
        This posting is provided "as is" with no warranties and confers no rights.

        --------------------
        | From: "serge anton" <serge.anton@ta koma.fr>
        | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
        | Subject: refresh the screen
        | Date: Fri, 12 Sep 2003 23:40:55 +0200
        | X-Priority: 3
        | X-MSMail-Priority: Normal
        | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
        | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
        | Lines: 21
        | Message-ID: <3f623d69$0$751 4$79c14f64@nan-newsreader-02.noos.net>
        | Organization: Noos
        | NNTP-Posting-Date: 12 Sep 2003 21:40:57 GMT
        | NNTP-Posting-Host: 81.64.121.30
        | X-Trace: 1063402857 news.noos.fr 7514 81.64.121.30
        | X-Complaints-To: abuse@noos.fr
        | Path:
        cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new sfeed00.sul.t-online.de!t-onlin
        e.de!newsfeed.i cl.net!newsfeed .fjserv.net!new s.tele.dk!news. tele.dk!small.n e
        ws.tele.dk!olea ne.net!oleane!t easer.fr!noos.f r!not-for-mail
        | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1845 41
        | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
        |
        | Hi,
        |
        | I want to refresh all the screen (including the desktop) or a part of the
        | screen.
        | I can have a reference to the screen with win32 API :
        |
        | [DllImport("user 32")]
        | public static extern int GetWindowDC(Int Ptr hwnd);
        |
        | private void fct(){
        | Graphics g = Graphics.FromHd c(new IntPtr(GetWindo wDC(IntPtr.Zero )));
        | }
        |
        | But I don't know how to refresh the screen or a part of the screen
        |
        | Thanks to help me
        |
        | Serge
        |
        |
        |
        |

        Comment

        Working...