Even more WIN32OLE_EVENT

Hi,

I'm still having trouble with the message_loop construct.

For my use, it's not acceptable that it takes 100% CPU fetching and
dispatching messages.

Even the simple test-application using IE found on
http://www.rubycentral.com/book/lib_windows.html uses 100% CPU doing
practically nothing...

I tried modifying the win32ole library to use GetMessage instead of
PeekMessage (causing it to wait until a message is available). This worked
for the simple IE application, but my application caused ruby to segfault.
Perhaps because I'm using threading?

I know I've asked this before, but once again I must ask if anyone has a
solution to this problem?

//F

When I've used PeekMessage/GetMessage like functions, I've called them
via ruby-dl instead of win32ole. Have you tried that route?

Dan Amelang

···

On 9/28/05, Fredrik Jagenheim <jagenheim@gmail.com> wrote:

Hi,

I'm still having trouble with the message_loop construct.

For my use, it's not acceptable that it takes 100% CPU fetching and
dispatching messages.

Even the simple test-application using IE found on
http://www.rubycentral.com/book/lib_windows.html uses 100% CPU doing
practically nothing...

I tried modifying the win32ole library to use GetMessage instead of
PeekMessage (causing it to wait until a message is available). This worked
for the simple IE application, but my application caused ruby to segfault.
Perhaps because I'm using threading?

I know I've asked this before, but once again I must ask if anyone has a
solution to this problem?

//F

Hello,

Even the simple test-application using IE found on
http://www.rubycentral.com/book/lib_windows.html uses 100% CPU doing
practically nothing...

Does sleep method help you?

  catch(:done) {
    loop {
      sleep 0.05
      WIN32OLE_EVENT.message_loop
    }
  }

  Regards,
  Masaki Suketa

···

In message "Even more WIN32OLE_EVENT" on 05/09/28, Fredrik Jagenheim <jagenheim@gmail.com> writes:

It's not the actual PeekMessage/GetMessage functionality I want. I want the
functionality I get from win32ole. But since win32ole_event#message_loop is
implemented using PeekMessage, it will use 100% CPU while running.
Recompiling win32ole using GetMessage was a hack that didn't work as well as
I had hoped...

Perhaps the only solution is to rewrite the interaction with my OLE object
using a custom C-library that I can call from ruby and just ditch the entire
win32ole lib idea.

--F

···

On 9/29/05, Daniel Amelang <daniel.amelang@gmail.com> wrote:

When I've used PeekMessage/GetMessage like functions, I've called them
via ruby-dl instead of win32ole. Have you tried that route?

Perhaps the only solution is to rewrite the interaction with my OLE object
using a custom C-library that I can call from ruby and just ditch the entire
win32ole lib idea.

Yea, sounds like it. Not to harp on ruby-dl, but I've been able to do
much of my custom c library stuff lately with ruby-dl. That way I
don't have to deal with a C compiler on windows :slight_smile: So include that as
a second possibility.

Dan Amelang