🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1747

Re: WM_TIMER

#1747
From: Bob Gonder
Date: Wed, 13 Jun 2007 17:45
43 lines
1858 bytes
Robert G. Hoover wrote:

And just to prove it for yourself

Add this to your favourite WinApp

In File Global Area:
static	int	counter[2] = {0,0};
static	int	counter_number = 0;

In  WinProc():
	In	 case WM_CREATE:
			SetTimer( hWnd, 0, 200, NULL );
			SetTimer( hWnd, 1, 10000, NULL );
	Add
		case WM_TIMER:
		switch (wParam) 
		{ case 0:
			++counter[counter_number];
			Sleep(210); 
			return 0;
		case 1:
			if( counter_number )
			{	PostMessage( hWnd, WM_CLOSE,0,0);
				KillTimer( hWnd, 1 );
				return 0;
			};
			++counter_number; 
			KillTimer( hWnd, 0 );
			return 0; 
		}; 
		break;
In  WinMain() just before return:

	char	results[1024];
	wsprintf( results,	" Number of 200ms messages processed"
			" in 10 seconds: %i\r\n"
			" Number of 200ms messages processed"
			" after timer killed: %i\r\n",
					 counter[0],counter[1]);
	MessageBox( 0, results, "TimerCheck", MB_OK );

My result was 47 and 0
Technical Details
Message-ID: <0ta073l2sp7r92vavqh5hbsd986pmf41ek@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4670167b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ca5452dcf06fe42a
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: WM_TIMER
Date: Wed, 13 Jun 2007 10:45:22 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <0ta073l2sp7r92vavqh5hbsd986pmf41ek@4ax.com>
References: <4670167b@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.86.80
X-Trace: newsgroups.borland.com 1181756720 69.69.86.80 (13 Jun 2007 10:45:20 -0700)
Lines: 46
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail