On Dec 12, 2011, at 6:24 AM, Shareef J. wrote:

> Hi there,
> 
> just having a quick play with WIN32OLE and it looks like the
> message_loop is taking 100% CPU utilisation.  What have I done wrong?
> This is running on ruby 1.9.2p136 in WinXP and using Office 2007.
> 
> http://pastie.org/3004860

This is how #message_loop is supposed to work. It polls the Win32 event sink and processes all of the events that are in queue. Try putting a short sleep in your "loop do" like "sleep(0.1) # 100 ms".

Your code won't run much slower but the CPU utilization will be lower.

cr