Sign in to follow this  
cartographer

[.net] How can i inform my application any change in display?

Recommended Posts

Not easily.

The two approaches which are commonly used, is either polling the screen for changes (very, very expensive), or using Windows system hooks to monitor WM_PAINT messages (cheaper, but less reliable). VNC uses a combination of both.

The only other way would be to have some kind of hook in the display driver, which is nontrivial. This is how some remote control programs such as RAdmin work (I think).

Of course there may be a way to do it on Windows 2003 (Maybe XP) which utilises Terminal Server in some way, but that interface could be undocumented and subject to change.

Mark

Share this post


Link to post
Share on other sites
I'm not sure I understand your question 100% but I'll give it a shot. If you've drawn or are drawing to your window and want it to refresh, one of the slower but easier ways of doing this is by:

1) first, adding or overriding the Form's OnPaint event (to add one: Form.Paint += New PaintEventHandler(Form_OnPaint))

2) next, just call the Form.Invalidate() method which will cause the Form to repaint itself (by calling Form_OnPaint). You can call Form.Invalidate() using a Timer's Tick event or you could just call it whenever you want to redraw.

Jason

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this