<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx</link><description>Dragging.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1736016</link><pubDate>Wed, 21 Feb 2007 19:48:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1736016</guid><dc:creator>Nitpick</dc:creator><description>
&lt;p&gt;&amp;gt; there's only one mouse, you can't have multiple drag operations in progress at once&lt;/p&gt;

&lt;p&gt;Not necessarily. &amp;nbsp;There's MultiPoint.&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;Sigh. Do I have to preface every sentence with "In the Win32 programming model"? -Raymond&lt;/i&gt;]&lt;/div&gt;</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1736046</link><pubDate>Wed, 21 Feb 2007 19:58:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1736046</guid><dc:creator>Manu</dc:creator><description>
&lt;p&gt;We use LockWindowUpdate for avoiding extensive redraw operations when reorganizing child windows/controls in an window. Without it you can see the windows changing position, with it you don't and you just go from one layout to the new one without flickering.&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;That's what DeferWindowPos is for. -Raymond&lt;/i&gt;]&lt;/div&gt;</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1736075</link><pubDate>Wed, 21 Feb 2007 20:06:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1736075</guid><dc:creator>Rob</dc:creator><description>
&lt;p&gt;Isn't WM_SETREDRAW preferred for avoiding flicker in such cases?&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;Please be patient. The series continues all week. -Raymond&lt;/i&gt;]&lt;/div&gt;</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1736247</link><pubDate>Wed, 21 Feb 2007 20:47:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1736247</guid><dc:creator>El Guapo</dc:creator><description>&lt;p&gt;Why do other windows flicker when I use LockWindowUpdate?&lt;/p&gt;
</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1736417</link><pubDate>Wed, 21 Feb 2007 21:16:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1736417</guid><dc:creator>Devlin Bentley</dc:creator><description>&lt;p&gt;Awesome, things like this rock. &amp;nbsp;I am finishing up my last 2 quarters getting a CS degree, but things like this will never be learned inside of a class room, and I am willing to bet that they would take a long time to learn on the job as well! &amp;nbsp;(Especially judging from the goodly number of replies by people who don't know what the function is for! :) )&lt;/p&gt;
&lt;p&gt;Thanks for the knowledge transfer!&lt;/p&gt;
</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1736424</link><pubDate>Wed, 21 Feb 2007 21:17:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1736424</guid><dc:creator>BryanK</dc:creator><description>&lt;p&gt;Can I vote for a:&lt;/p&gt;
&lt;p&gt;#define LockWindowUpdate LockDragWindow&lt;/p&gt;
&lt;p&gt;in the Platform SDK for the next Windows, along with an update to the exports in user32, (add the new name, plus a forwarder entry for the old name, so current programs keep working -- the param could stay the same)? &amp;nbsp;:-P&lt;/p&gt;
&lt;p&gt;(Actually, that may be possible, but it's likely a waste of time. &amp;nbsp;Too bad...)&lt;/p&gt;
</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1737215</link><pubDate>Wed, 21 Feb 2007 23:42:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1737215</guid><dc:creator>Jackie</dc:creator><description>&lt;p&gt;&amp;gt; Why do other windows flicker when I use LockWindowUpdate?&lt;/p&gt;
&lt;p&gt;Perhaps it is to discourage you from using LockWindowUpdate?&lt;/p&gt;
</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1737238</link><pubDate>Wed, 21 Feb 2007 23:46:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1737238</guid><dc:creator>Jackie</dc:creator><description>&lt;P&gt;&amp;gt; Why do other windows flicker when I use LockWindowUpdate?&lt;/P&gt;
&lt;P&gt;Perhaps it is to discourage you from using LockWindowUpdate inappropriately?&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;I bet you locked the desktop. -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1737239</link><pubDate>Wed, 21 Feb 2007 23:46:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1737239</guid><dc:creator>Manu</dc:creator><description>&lt;P&gt;DeferWindowPos is a little bit complicated to use when you have a lot of existing code based on the traditional way of positioning windows.&lt;/P&gt;
&lt;P&gt;When building a window you can easily put everything at the right place to begin with and it does not have any visible or slow down effect.&lt;/P&gt;
&lt;P&gt;It is more troublesome when you have to handle resizing and you have implemented very specific resizing policies based on WM_SIZE message.&lt;/P&gt;
&lt;P&gt;Using LockWindowUpdate is much simpler for these cases without having to rewrite a lot of code.&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;You'll learn another solution tomorrow. -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1737563</link><pubDate>Thu, 22 Feb 2007 01:22:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1737563</guid><dc:creator>eikonos</dc:creator><description>&lt;P&gt;Since LockWindowUpdate is for dragging, why does the MSDN page on it have no indication of that at all? &amp;nbsp;The word 'drag' isn't anywhere on the page.&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;(1) &lt;A href="http://blogs.msdn.com/oldnewthing/archive/2007/02/19/1716211.aspx#1716440"&gt;I already addressed this&lt;/A&gt;. (2) It's already &lt;A href="http://msdn.microsoft.com/library/en-us/gdi/pantdraw_3wtj.asp"&gt;linked from the LockWindowUpdate documentation&lt;/A&gt;. You get there via "See Also: Painting and Drawing Overview". -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1737898</link><pubDate>Thu, 22 Feb 2007 03:13:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1737898</guid><dc:creator>Dan</dc:creator><description>&lt;p&gt;Raymond,&lt;/p&gt;
&lt;p&gt;Could you include a small code example that shows how LockWindowUpdate might be used in conjuctions with ImageList_DragShowNolock, ImageList_DragMove with the added complication of handing scrolling when dragging near the target window border. I'm sure the ordering is crucial (as it often is) but I just can't seem to get it right without flicker and redraw artifacts. :(&lt;/p&gt;
</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1738962</link><pubDate>Thu, 22 Feb 2007 08:02:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1738962</guid><dc:creator>Pieter Breed</dc:creator><description>
&lt;p&gt;Hi Raymond,&lt;/p&gt;

&lt;p&gt;Your first poster queried the assumption about only one mouse, and you added that that assumption is in the win32 programming model. I don't believe you have to preface everything you say with "In the win32 programming model" at all.&lt;/p&gt;

&lt;p&gt;This does however raise an interesting discussion point. There _are_ more than one mouse present on some systems. Some games (kung-fu hustle, for example) encourages more than one mouse. Other applications might do the same.&lt;/p&gt;

&lt;p&gt;How does win32 then cope with this? What other assumptions (aside from this one scenario) fails with more than one mouse present in the system? Maybe even more general than that, how does the win32 team go about keeping up with changing assumptions?&lt;/p&gt;

&lt;p&gt;Regards,&lt;/p&gt;

&lt;p&gt;Pieter&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;No need to ask when you can see for yourself. Plug in two USB mice. -Raymond&lt;/i&gt;]&lt;/div&gt;</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1740595</link><pubDate>Thu, 22 Feb 2007 12:19:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1740595</guid><dc:creator>Steve Thresher</dc:creator><description>&lt;p&gt;Can't wait for the rest of this series!&lt;/p&gt;
</description></item><item><title>Multiple mice</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1741846</link><pubDate>Thu, 22 Feb 2007 17:00:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1741846</guid><dc:creator>Rune</dc:creator><description>&lt;p&gt;First off, thank you for taking on LockWindowUpdate(). Learning about DeferWindowPos() was a very nice bonus!&lt;/p&gt;
&lt;p&gt;That said, my first thought was &amp;quot;so this is why two mice aren't supported&amp;quot;. (meaning they both control the same cursor IIRC)&lt;/p&gt;
&lt;p&gt;A couple of years ago, I had two computers on my desk. I operated my main computer with my left hand (I'm right handed btw) and the other with my right hand. The brain halves won't allow this to work asynchronously (atleast mine won't), but you can sort of fake it, and on larger monitors you should be able to shave off some time (move the closest mouse cursor).&lt;/p&gt;
&lt;p&gt;I.e. it's not entirely a bad idea... Specially not on three+ monitor systems... (granted, you never argued it was a bad idea, I'm just offering some input for future topics)&lt;/p&gt;
</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1741877</link><pubDate>Thu, 22 Feb 2007 17:09:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1741877</guid><dc:creator>Dan</dc:creator><description>&lt;p&gt;In case you don't have a spare mouse on hand... there's still only one cursor, and both mice would control it. &lt;/p&gt;
&lt;p&gt;There's an interesting program called GlovePIE somewhere out there which allows you to map keys, mouse buttons and movements, joystick axis and buttons, etc etc etc to each other. &amp;nbsp;One of the interesting features is it can create additional fake mouse pointers which you can map to things. &amp;nbsp;Of course the fake pointers don't work 100% (I believe they only send fake window messages) but it's still interesting to experiment with.&lt;/p&gt;
&lt;p&gt;&amp;gt; Can I vote for a:&lt;/p&gt;
&lt;p&gt;&amp;gt; #define LockWindowUpdate LockDragWindow&lt;/p&gt;
&lt;p&gt;If you want it so bad just do:&lt;/p&gt;
&lt;p&gt;#define LockDragWindow LockWindowUpdate&lt;/p&gt;
&lt;p&gt;in your own code and let MS name things how they want to. :)&lt;/p&gt;
</description></item><item><title>With what operations is LockWindowUpdate not meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1742085</link><pubDate>Thu, 22 Feb 2007 18:00:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1742085</guid><dc:creator>The Old New Thing</dc:creator><description>&lt;p&gt;Um, not dragging.&lt;/p&gt;</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1742471</link><pubDate>Thu, 22 Feb 2007 19:22:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1742471</guid><dc:creator>Ulric</dc:creator><description>&lt;p&gt; kung-fu hustle?&lt;/p&gt;
&lt;p&gt;There is only one pointing device in windows at a time. &amp;nbsp;you have pen and a mouse, whoever moved last is the last mouse message, they are fighting for the same global pointer. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Games would use DirectInput&lt;/p&gt;
</description></item><item><title>re: With what operations is LockWindowUpdate meant to be used?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#1742852</link><pubDate>Thu, 22 Feb 2007 20:55:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1742852</guid><dc:creator>Nitpick</dc:creator><description>&lt;P&gt;&amp;gt; Do I have to preface every sentence with "In the Win32 programming model&lt;/P&gt;
&lt;P&gt;I thought MSR built this on top of Win32...&lt;/P&gt;
&lt;P&gt;Anyway it is obvious that the API was designed years before anyone thought about multiple pointers.&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;Right, it's built &lt;U&gt;on top of&lt;/U&gt; Win32. Win32 doesn't know about these extra pointers. -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>LockWindowUpdate系列3：什么样的操作中应当使用LockWindowUpdate？</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx#2409842</link><pubDate>Fri, 04 May 2007 16:17:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2409842</guid><dc:creator>BalonFan</dc:creator><description>&lt;p&gt;LockWindowUpdate就是专门设计用于这些拖拽场景的。由于拖拽对象要用到鼠标按键，而只会有一个鼠标，故而同一时间不会有多个拖拽操作进行。因此，没有必要同时锁定多个窗口的更新。也许这个函数应当更准确的命名为LockDragWindow。&lt;/p&gt;
</description></item></channel></rss>