<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : 20% CPU when mouse moving, Why?</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : 20% CPU when mouse moving, Why?]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 14 May 2026 04:30:08 +0000</pubDate>
  <lastBuildDate>Mon, 10 Aug 2009 11:51:47 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=14705</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? : Played a bit with Spy++ and RibbonControls...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=51822&amp;title=20-cpu-when-mouse-moving-why#51822</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2198">znakeeye</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 10 August 2009 at 11:51am<br /><br /><P>Played a bit with Spy++ and RibbonControls demo. I sense a CJ window message is in fact the culprit:</P><DIV><FONT color=#010001 size=2><FONT color=#010001 size=2>XTP_TTM_WINDOWFROMPOINT</FONT></FONT></DIV><DIV><FONT color=#010001 size=2><FONT color=#010001 size=2></FONT></FONT>&nbsp;</DIV><DIV><FONT color=#010001 size=2><FONT color=#010001 size=2>So IsIdleMessage should look something like this (if this solution proves to be an improvement, CJ should derive CWinApp and let us use that class as base):</FONT></FONT></DIV><DIV><FONT color=#010001 size=2><FONT color=#010001 size=2></FONT></FONT>&nbsp;</DIV><DIV><FONT color=#010001><FONT color=#010001><FONT size=2><FONT color=#000000>BOOL CXTPWinApp::IsIdleMessage(MSG* pMsg)<BR>{<BR>&nbsp;&nbsp;&nbsp; return (CWinApp::IsIdleMessage(pMsg) &amp;&amp;</FONT></FONT></FONT></FONT></DIV><DIV><FONT color=#010001><FONT color=#010001><FONT size=2><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (pMsg-&gt;message != WM_TIMER) &amp;&amp;</FONT></FONT></FONT></FONT></DIV><DIV><FONT color=#010001><FONT color=#010001><FONT size=2><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (pMsg-&gt;message != <FONT color=#010001>XTP_TTM_WINDOWFROMPOINT &amp;&amp;</FONT></FONT></FONT></FONT></FONT></DIV><DIV><FONT color=#010001><FONT color=#010001><FONT size=2><FONT color=#000000><FONT color=#010001>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (pMsg-&gt;message != <FONT color=#010001 size=2><FONT color=#010001 size=2>XTP_TTM_SETIMAGE</FONT></FONT></FONT>)); // Possibly, more messages than these should be added?<BR>}</FONT></FONT></FONT></FONT></DIV><DIV><FONT size=2></FONT><FONT color=#010001><FONT color=#010001><FONT size=2>&nbsp;</DIV></FONT></FONT></FONT>]]>
   </description>
   <pubDate>Mon, 10 Aug 2009 11:51:47 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=51822&amp;title=20-cpu-when-mouse-moving-why#51822</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? : Just wondering what you guys made...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=51821&amp;title=20-cpu-when-mouse-moving-why#51821</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2198">znakeeye</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 10 August 2009 at 11:37am<br /><br />Just wondering what you guys made out of this. Is it worth putting this in my CJ-ribbon application?<DIV>&nbsp;</DIV><DIV>"<strong>Default implementation</strong> filters out WM_PAINT message, <strong>redundant WM_MOUSEMOVE</strong> messages and system timer message used for caret blinking."</DIV><DIV>&nbsp;</DIV><DIV>That not enough?</DIV>]]>
   </description>
   <pubDate>Mon, 10 Aug 2009 11:37:31 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=51821&amp;title=20-cpu-when-mouse-moving-why#51821</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? : If the mouse is using the Intellipoint...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=51127&amp;title=20-cpu-when-mouse-moving-why#51127</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=5336">tralfaz</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 20 July 2009 at 9:42pm<br /><br />If the mouse is using the Intellipoint driver, disable it. There are some known problems with it. Namely, it generates random and frequent WM_PAINT messages.]]>
   </description>
   <pubDate>Mon, 20 Jul 2009 21:42:37 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=51127&amp;title=20-cpu-when-mouse-moving-why#51127</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? :    scottp wrote:I just tried...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=51015&amp;title=20-cpu-when-mouse-moving-why#51015</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3353">Howard Farseer</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 16 July 2009 at 1:37pm<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by scottp" alt="Originally posted by scottp" style="vertical-align: text-bottom;" /> <strong>scottp wrote:</strong><br /><br />I just tried this in my app (we have a timer 50ms timer) and it does make a difference.<br><br>While doing some futher reading I found the suggestion to also filter<span style="font-family: monospace;"> </span>WM_MOUSEMOVE<br><br>see this for more detail: http://www.eggheadcafe.com/conversation.aspx?messageid=32023078&amp;threadid=32007742<br><br>BOOL CMyApp::IsIdleMessage(MSG* pMsg)<br>{<br>&nbsp;&nbsp;&nbsp; return (CWinApp::IsIdleMessage(pMsg) &amp;&amp; (pMsg-&gt;message!=WM_TIMER) &amp;&amp; (pMsg-&gt;message!=WM_MOUSEMOVE));<br>}<br><br>This change appears to work OK and the CPU usage is really low. I am not sure if this might have some negative impacts on mouse handling code (for example mouse leave/enter notifications).<br></td></tr></table><br><br>Yes! <span style="font-family: monospace;"></span>WM_MOUSEMOVE makes a big difference for me. Now the CPU usage is really low. Thanks scottp!<br>]]>
   </description>
   <pubDate>Thu, 16 Jul 2009 13:37:40 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=51015&amp;title=20-cpu-when-mouse-moving-why#51015</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? : I just tried this in my app (we...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50978&amp;title=20-cpu-when-mouse-moving-why#50978</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2432">scottp</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 15 July 2009 at 3:31am<br /><br />I just tried this in my app (we have a timer 50ms timer) and it does make a difference.<br><br>While doing some futher reading I found the suggestion to also filter<span style="font-family: monospace;"> </span>WM_MOUSEMOVE<br><br>see this for more detail: http://www.eggheadcafe.com/conversation.aspx?messageid=32023078&amp;threadid=32007742<br><br>BOOL CMyApp::IsIdleMessage(MSG* pMsg)<br>{<br>&nbsp;&nbsp;&nbsp; return (CWinApp::IsIdleMessage(pMsg) &amp;&amp; (pMsg-&gt;message!=WM_TIMER) &amp;&amp; (pMsg-&gt;message!=WM_MOUSEMOVE));<br>}<br><br>This change appears to work OK and the CPU usage is really low. I am not sure if this might have some negative impacts on mouse handling code (for example mouse leave/enter notifications).<br>]]>
   </description>
   <pubDate>Wed, 15 Jul 2009 03:31:57 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50978&amp;title=20-cpu-when-mouse-moving-why#50978</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? :     Howard Farseer wrote:Thanks,...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50902&amp;title=20-cpu-when-mouse-moving-why#50902</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=109">mgampi</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 13 July 2009 at 4:31am<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by Howard Farseer" alt="Originally posted by Howard Farseer" style="vertical-align: text-bottom;" /> <strong>Howard Farseer wrote:</strong><br /><br />Thanks, but it doesn't work for me. what is EWM_DEVICESTATISTICS?</td></tr></table><br>Hi; <br>it's an app specific message. You can ignore it!<br>]]>
   </description>
   <pubDate>Mon, 13 Jul 2009 04:31:30 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50902&amp;title=20-cpu-when-mouse-moving-why#50902</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? :    mgampi wrote:Hello;I don&amp;#039;t...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50877&amp;title=20-cpu-when-mouse-moving-why#50877</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3353">Howard Farseer</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 11 July 2009 at 4:34pm<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by mgampi" alt="Originally posted by mgampi" style="vertical-align: text-bottom;" /> <strong>mgampi wrote:</strong><br /><br />Hello;<br><br>I don't know whether it's the same issue, but a few years ago we had the same problems with applications using timers with short delay and GUI updates. We were able to reduce CPU usage from about 40% to 1% by overwriting CWinApp::IsIdleMessage and returning FALSE when it's a WM_TIMER message too:<br><br>BOOL CXREngineApp::IsIdleMessage(MSG* pMsg)<br>{<br>&nbsp;&nbsp;&nbsp; return (CWinApp::IsIdleMessage(pMsg) &amp;&amp; (pMsg-&gt;message!=WM_TIMER) &amp;&amp; (pMsg-&gt;message!=EWM_DEVICESTATISTICS));<br>}<br><br><br></td></tr></table><br>Thanks, but it doesn't work for me. what is EWM_DEVICESTATISTICS?]]>
   </description>
   <pubDate>Sat, 11 Jul 2009 16:34:58 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50877&amp;title=20-cpu-when-mouse-moving-why#50877</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? : mgampi&amp;#039;s post looks very...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50871&amp;title=20-cpu-when-mouse-moving-why#50871</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 11 July 2009 at 9:29am<br /><br /><P>mgampi's post looks very promising since in our app I have already detected that idle processing keeps running and the timer is going off every 50 ms. The MSDN says this: If an application has created a short timer, <B>OnIdle </B>will be called frequently, causing performance problems. To improve such an application's performance, override <B>IsIdleMessage</B> in the application's <B>CWinApp</B>-derived class to check for <B>WM_TIMER</B> messages.</P><DIV>I don't have access to our source but as soon as I do I will see if we override the method, inherit from the CJ frame class or implemented our own. Then I'll add the above code to our implementation. Thanks mgampi for what I believe is the solution to the problem. CJ may want to try this in their ribbonsample (which I will also try when I get back to work) and if it solves the problem, add the same solution to their frame window classes.</DIV>]]>
   </description>
   <pubDate>Sat, 11 Jul 2009 09:29:38 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50871&amp;title=20-cpu-when-mouse-moving-why#50871</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? : Hello;I don&amp;#039;t know whether...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50868&amp;title=20-cpu-when-mouse-moving-why#50868</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=109">mgampi</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 10 July 2009 at 5:16pm<br /><br />Hello;<br><br>I don't know whether it's the same issue, but a few years ago we had the same problems with applications using timers with short delay and GUI updates. We were able to reduce CPU usage from about 40% to 1% by overwriting CWinApp::IsIdleMessage and returning FALSE when it's a WM_TIMER message too:<br><br>BOOL CXREngineApp::IsIdleMessage(MSG* pMsg)<br>{<br>&nbsp;&nbsp;&nbsp; return (CWinApp::IsIdleMessage(pMsg) &amp;&amp; (pMsg-&gt;message!=WM_TIMER) &amp;&amp; (pMsg-&gt;message!=EWM_DEVICESTATISTICS));<br>}<br><br><br>]]>
   </description>
   <pubDate>Fri, 10 Jul 2009 17:16:20 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50868&amp;title=20-cpu-when-mouse-moving-why#50868</guid>
  </item> 
  <item>
   <title><![CDATA[20% CPU when mouse moving, Why? : CPU usage on my app using V13.0...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50854&amp;title=20-cpu-when-mouse-moving-why#50854</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 14705<br /><strong>Posted:</strong> 10 July 2009 at 10:04am<br /><br />CPU usage on my app using V13.0 of CJ spikes to around 50%. <DIV>&nbsp;</DIV><DIV>The system is being deluged with a timer that is triggered every 50ms.&nbsp;The timer is not being set when I move onto the command ribbon as long as I am in an unoccupied area. But move the mouse into the "tab" strip (not even over a tab) and the timer is set. Or move the mouse onto any group (don't have to move over a control) and it is set. The timer trips until the WM_MOUSELEAVE message is processed by the ribbon at which point CJ cancels the timer. The timer function being set is CXTPMouseManager::TrackMouseTimerProc and it is being set in CXTPMouseManager::TrackMouseLeave, which is called&nbsp;whenever the menubar base class (commandbar derived class)&nbsp;gets a mouse move (forwarded from the ribbon object).</DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>At least that is what is happening in my app.</DIV><DIV>&nbsp;</DIV><DIV>To see if this is what is happening on your system, start the debug version of your app and start spy++. Then use the FindWindow command of spy++ and drag the mouse over the command ribbon and select it. Click the "messages" radio button. Then activate your app and move the mouse over the ribbon so that it moves over the tab area or a group. Then just leave the mouse where it is (to avoid other messages being logged). I quickly see only a steady stream of WM_TIMER messages being reported by spy++ in the messages window.</DIV><DIV>&nbsp;</DIV><DIV>Do NOT have the debugger attached to your app while you are spying on the app as the debugger and spy++ can cause a system deadlock when both attach to a process (not actually a deadlock but it can take forever to get the task manager activated after which you have to kill devenv.exe to get control of the system back).</DIV><DIV>&nbsp;</DIV><DIV>Once you see the WM_TIMER messages in spy++, you will see "tmprc:" followed by a hex address on each WM_TIMER line in the message logging window. This is the address of the timer proc function that is being called. Then shut down spy++ and go back to Visual Studio and attach to your process. Once you are attached, go to the "Breakpoints" window and click the "New" dropdown and choose "Break at function". When the dialog appears, key in the hex address and then move the mouse over the tab or group area. You should start breaking at the function (you will actually break at a "jmp" instruction and then step one time in the disassembly window and you will be at the hex address you set the breakpoint at.</DIV><DIV>&nbsp;</DIV><DIV>You may see the debugger tell you that there is no code for the breakpoint and you can choose the button that lets you see the disassembly window.</DIV><DIV>&nbsp;</DIV><DIV>The timer does not affect the performance of my app since very little processing&nbsp;is occurring in the timer function being called. However any other processes running are affected. But only while your app has focus (timer is cancelled when the app looses focus) and you have the timer running while leaving the mouse over the ribbon window. I am sure customers will notice this and complain. At least ours will as we have had them do so in the past. Some customers have the "As long as I am not doing anything, neither should the app" mentality.</DIV>]]>
   </description>
   <pubDate>Fri, 10 Jul 2009 10:04:05 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14705&amp;PID=50854&amp;title=20-cpu-when-mouse-moving-why#50854</guid>
  </item> 
 </channel>
</rss>