refresh the screen

S

serge anton

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("user32")]
public static extern int GetWindowDC(IntPtr hwnd);

private void fct(){
Graphics g = Graphics.FromHdc(new IntPtr(GetWindowDC(IntPtr.Zero)));
}

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

Thanks to help me

Serge
 
P

ppyrstr

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(HWND) which does the same
thing. I have never tried to use these on the entire
desktop, but it seem that they should work.
 
P

Peter Rilling

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?
 
J

Jeffrey Tan[MSFT]

Hi serge,

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

private void button1_Click(object sender, System.EventArgs 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" <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.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: <[email protected]>
| 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: (e-mail address removed)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.ne
ws.tele.dk!oleane.net!oleane!teaser.fr!noos.fr!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:184541
| X-Tomcat-NG: microsoft.public.dotnet.languages.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("user32")]
| public static extern int GetWindowDC(IntPtr hwnd);
|
| private void fct(){
| Graphics g = Graphics.FromHdc(new IntPtr(GetWindowDC(IntPtr.Zero)));
| }
|
| But I don't know how to refresh the screen or a part of the screen
|
| Thanks to help me
|
| Serge
|
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top