开发者

Prevent the entire screen from updating

开发者 https://www.devze.com 2023-02-06 10:39 出处:网络
Edit 1: Actually, I was only wanted to avoid the the flicker caused by closing a Word document and opening another one. But now it looks this approach is not feasible.

Edit 1: Actually, I was only wanted to avoid the the flicker caused by closing a Word document and opening another one. But now it looks this approach is not feasible.

Greetings, is it possible to Prevent the entire screen (not only the desktop) from updating? The question is derived from this one. What I want to do is that, in my Word add-in, to lock the entire screen update when I'm closing a Word document and opening another one, and re-enable the update when I'm done.

An idea would be:

  1. Get the image of the entire screen (how?);
  2. Show a top-most window to show the screen image captured in step 1, to cover 开发者_JS百科the entire screen;
  3. Do my job and close the top-most window when done.

Is it possible? Or do you have other better ideas? Thanks!


Don't.

No app, plugin, or other very nice piece of code can never be so special as to intrude - even for a short time - what the user owns: his UI.

The Old New Thing (Raymond Chen) has a few very nice posts in this, varying from LockWindowUpdate, to locking gadges in place and other user-hostile features.

Living in a multi-threaded world, means you should expect that your user will do multiple things at the same time.

Locking anything for purposes as "to make it look nice" - even for a very short period of time - is a complete no-no.

Your request is just the first step towards the dreaded system-modal dialog "Are you sure you want to do this bad thing to your computer?" with buttons Yes and No, where Yes is the default button, in the midst of the user typing a long story, pressing the space bar.

--jeroen


to prevent screen updates:

SendMessage(GetDesktopWindow, WM_SETREDRAW, 0, 0);

to re-enable screen updates:

SendMessage(GetDesktopWindow, WM_SETREDRAW, 1, 0);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号