<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'How can I use a timer in Win32??' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'How can I use a timer in Win32??' posted on the 'Windows programming' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 13:58:34 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 13:58:34 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>How can I use a timer in Win32??</title>
      <link>http://www.programmersheaven.com/mb/windows/39119/39119/how-can-i-use-a-timer-in-win32/</link>
      <description>I'm trying to figure out how to use timers in Win32 so that I can time certain events, such as fade-ins. I currently use a for(x,x,x) loop, but even though that works great on our old p1/200mmx, it is un-noticeable on the p3/500. I would like to time it to about 500ms intervals for the next shading. Any help would be greatly appreciated. Thanks for your time!&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-Seph&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/windows/39119/39119/how-can-i-use-a-timer-in-win32/</guid>
      <pubDate>Fri, 03 Nov 2000 17:52:44 -0700</pubDate>
      <category>Windows programming</category>
    </item>
    <item>
      <title>Re: How can I use a timer in Win32??</title>
      <link>http://www.programmersheaven.com/mb/windows/39119/39435/re-how-can-i-use-a-timer-in-win32/#39435</link>
      <description>Hey Seph,&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Try this code&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
// wait for 500 ms&amp;lt;br&amp;gt;&lt;br /&gt;
DWORD dwTime = GetTickCount();&amp;lt;br&amp;gt;&lt;br /&gt;
while( ( GetTickCount() - dwTime ) &amp;gt; 500 );&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If you want a very accurate timer, check out the multimedia timer functions in MSDN, I think I posted something about that in here a while ago, or maybe the C++ board. Cant remember!&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
: I'm trying to figure out how to use timers in Win32 so that I can time certain events, such as fade-ins. I currently use a for(x,x,x) loop, but even though that works great on our old p1/200mmx, it is un-noticeable on the p3/500. I would like to time it to about 500ms intervals for the next shading. Any help would be greatly appreciated. Thanks for your time!&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: -Seph&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/windows/39119/39435/re-how-can-i-use-a-timer-in-win32/#39435</guid>
      <pubDate>Mon, 06 Nov 2000 14:25:40 -0700</pubDate>
      <category>Windows programming</category>
    </item>
    <item>
      <title>Re: Re: How can I use a timer in Win32??</title>
      <link>http://www.programmersheaven.com/mb/windows/39119/39436/re-re-how-can-i-use-a-timer-in-win32/#39436</link>
      <description>Should be&amp;lt;br&amp;gt;&lt;br /&gt;
while( ( GetTickCount() - dwTime ) &amp;lt; 500 );&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
: Hey Seph,&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: Try this code&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: // wait for 500 ms&amp;lt;br&amp;gt;&lt;br /&gt;
: DWORD dwTime = GetTickCount();&amp;lt;br&amp;gt;&lt;br /&gt;
: while( ( GetTickCount() - dwTime ) &amp;gt; 500 );&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: If you want a very accurate timer, check out the multimedia timer functions in MSDN, I think I posted something about that in here a while ago, or maybe the C++ board. Cant remember!&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: : I'm trying to figure out how to use timers in Win32 so that I can time certain events, such as fade-ins. I currently use a for(x,x,x) loop, but even though that works great on our old p1/200mmx, it is un-noticeable on the p3/500. I would like to time it to about 500ms intervals for the next shading. Any help would be greatly appreciated. Thanks for your time!&amp;lt;br&amp;gt;&lt;br /&gt;
: : &amp;lt;br&amp;gt;&lt;br /&gt;
: : -Seph&amp;lt;br&amp;gt;&lt;br /&gt;
: : &amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/windows/39119/39436/re-re-how-can-i-use-a-timer-in-win32/#39436</guid>
      <pubDate>Mon, 06 Nov 2000 14:26:23 -0700</pubDate>
      <category>Windows programming</category>
    </item>
    <item>
      <title>Re: Re: Re: How can I use a timer in Win32??</title>
      <link>http://www.programmersheaven.com/mb/windows/39119/39560/re-re-re-how-can-i-use-a-timer-in-win32/#39560</link>
      <description>That's no good.  My Borland help file says that "GetTickCount" just returns the number of milliseconds since Windoze was started.  Also says that at 49.7 days it will wrap to 0.  Here is the fade from red (after the screen fills with blood) to black code.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
for(int x = 0; x &amp;lt; 256; x++)&amp;lt;br&amp;gt;&lt;br /&gt;
{&amp;lt;br&amp;gt;&lt;br /&gt;
while((GetTickCount() - dwTime) &amp;lt; 500)&amp;lt;br&amp;gt;&lt;br /&gt;
FillRect(fDC, &amp;amp;faderect, (CreateSolidBrush(RGB(255, x, x))));&amp;lt;br&amp;gt;&lt;br /&gt;
}&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Any other ideas? Oh and just in case it matters, all of this code is in "fight.dll", not my executeable.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-Seph&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/windows/39119/39560/re-re-re-how-can-i-use-a-timer-in-win32/#39560</guid>
      <pubDate>Tue, 07 Nov 2000 10:58:29 -0700</pubDate>
      <category>Windows programming</category>
    </item>
    <item>
      <title>Re: Re: Re: Re: How can I use a timer in Win32??</title>
      <link>http://www.programmersheaven.com/mb/windows/39119/39580/re-re-re-re-how-can-i-use-a-timer-in-win32/#39580</link>
      <description>So? why its not good? You can write a function like this:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
void MyDelay( DWORD dwMilliSeconds )&amp;lt;br&amp;gt;&lt;br /&gt;
{&amp;lt;br&amp;gt;&lt;br /&gt;
DWORD dwInitial = GetTickCount();&amp;lt;br&amp;gt;&lt;br /&gt;
while( ( GetTickCount() - dwInitial ) &amp;lt; dwMilliSeconds );&amp;lt;br&amp;gt;&lt;br /&gt;
}&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
As I understand, you want a delay, thats a difference between two snapshots of time. GetTickCount can do that perfectly well.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Or am I missing something, again!&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
: That's no good.  My Borland help file says that "GetTickCount" just returns the number of milliseconds since Windoze was started.  Also says that at 49.7 days it will wrap to 0.  Here is the fade from red (after the screen fills with blood) to black code.&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: for(int x = 0; x &amp;lt; 256; x++)&amp;lt;br&amp;gt;&lt;br /&gt;
: {&amp;lt;br&amp;gt;&lt;br /&gt;
: while((GetTickCount() - dwTime) &amp;lt; 500)&amp;lt;br&amp;gt;&lt;br /&gt;
: FillRect(fDC, &amp;amp;faderect, (CreateSolidBrush(RGB(255, x, x))));&amp;lt;br&amp;gt;&lt;br /&gt;
: }&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: Any other ideas? Oh and just in case it matters, all of this code is in "fight.dll", not my executeable.&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
: -Seph&amp;lt;br&amp;gt;&lt;br /&gt;
: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/windows/39119/39580/re-re-re-re-how-can-i-use-a-timer-in-win32/#39580</guid>
      <pubDate>Tue, 07 Nov 2000 12:43:30 -0700</pubDate>
      <category>Windows programming</category>
    </item>
    <item>
      <title>Re: Re: Re: Re: Re: How can I use a timer in Win32??</title>
      <link>http://www.programmersheaven.com/mb/windows/39119/39685/re-re-re-re-re-how-can-i-use-a-timer-in-win32/#39685</link>
      <description>That will work perfectly.  I didn't think of storing the current Tick and using it later.  I'll try this and see what happens.  It's heck just seeing a quick flash of red and black before the battle scene, lol!&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-Seph&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/windows/39119/39685/re-re-re-re-re-how-can-i-use-a-timer-in-win32/#39685</guid>
      <pubDate>Wed, 08 Nov 2000 09:15:03 -0700</pubDate>
      <category>Windows programming</category>
    </item>
  </channel>
</rss>