Can't using mouse with threads

From: Matt Vorne (
Date: 10/14/04

Date: 13 Oct 2004 21:19:56 -0700

Something happened for my computer's ability to spawn a mouse thread.
I'm following along with Tom Miller's book, Managed DirectX9, and the
sample project for the mouse can't load because it keeps getting a
nullpointer exception in the ThreadFunction() method.

The error occurs on this line:

int index = System.Threading.WaitHandle.WaitAny(handles);

System.NullReferenceException: Object reference not set to an instance
of an object.
   at System.Threading.WaitHandle.WaitMultiple(WaitHandle[]
waitHandles, Int32 millisecondsTimeout, Boolean exitContext, Boolean
   at System.Threading.WaitHandle.WaitAny(WaitHandle[] waitHandles,
Int32 millisecondsTimeout, Boolean exitContext)
   at System.Threading.WaitHandle.WaitAny(WaitHandle[] waitHandles)
   at Chapter15Code.Form1.ThreadFunction() in c:\program files\sams
publishing\mdxkickstart\c# code\chapter 15\mouse\form1.cs:line 82

I know this used to work on my computer at one point. The only thing
unique about it in my eyes is that it is an old IBM ZPRO dual proc
500mhz .

I take the same code and run it on another computer and it works. I'm
Running Win2k, latest service pack, 1/5 gig ram, dual proc 500