[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Sending and receiving windows messages with ruby.

awertyui

5/23/2005 7:29:00 PM

I'm trying to send and receive windows messages between a ruby app
and a c++ app but I'm not having any luck. I tried calling
sendmessage and getmessage using rubydl but I don't think that's
going to work because console apps don't have message queues right?
Well anyway I am trying to use wxRuby now and think I'm close but the
one function that I need to override or whatever to catch the messages
doesn't appear to be available in wxruby. From the faq on the site
says the function is called MSWWWindowProc()
http://www.wxwidgets.org/faqmsw.ht... .How do I go about
overriding this function so I can catch windows messages? If anyone
knows easy way to do this without a gui toolkit please let me know
because all I want to do is parse data in a console app and all these
gui toolkits make everything so difficult.

2 Answers

Shad Sterling

5/23/2005 9:44:00 PM

0

On 5/23/05, awertyui@gmail.com <awertyui@gmail.com> wrote:
> I'm trying to send and receive windows messages between a ruby app
> and a c++ app but I'm not having any luck. I tried calling
> sendmessage and getmessage using rubydl but I don't think that's
> going to work because console apps don't have message queues right?
> Well anyway I am trying to use wxRuby now and think I'm close but the
> one function that I need to override or whatever to catch the messages
> doesn't appear to be available in wxruby. From the faq on the site
> says the function is called MSWWWindowProc()
> http://www.wxwidgets.org/faqmsw.ht... .How do I go about
> overriding this function so I can catch windows messages? If anyone
> knows easy way to do this without a gui toolkit please let me know
> because all I want to do is parse data in a console app and all these
> gui toolkits make everything so difficult.
>
>
>

Since you're wanting to meddle in the windows API, you may want to use Win32API:
http://phrogz.net/ProgrammingRuby/lib_windows.htm...
(this may be equivelent to using Ruby/DL)

And I'm sure you'll need a Win32 API reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_api_star...
(though if you're using Visual Studio you may have a better reference
included with that)

Win32 Console Apps have everything that window apps have - the only
difference between them is that window apps have no STDIN, STDOUT, or
STDERR. A console app can do everything a window app can do, but a
window app can't do a few things that a console app can do.

I'm not at all familiar with wxwidgets or wxRuby, but I'd guess that
that wxwidgets is mostly for doing simple GUI stuff (which does not
include what you're trying to do), and that it's not possible for the
ruby bindings to allow you to create (in Ruby) a derived class from a
C++ class defined by wxwidgets. I could be wrong..

What you're doing has nothing to do with the GUI, so it's silly to
expect a GUI toolkit to help you with it.



- Shad


--

----------

Please do not send personal (non-list-related) mail to this address.
Personal mail should be sent to polyergic@sterfish.com.


Tyler Eaves

5/23/2005 11:58:00 PM

0

On Tue, 24 May 2005 06:43:39 +0900, Shad Sterling wrote:

>
> window app can't do a few things that a console app can do.
>
> I'm not at all familiar with wxwidgets or wxRuby, but I'd guess that
> that wxwidgets is mostly for doing simple GUI stuff (which does not
> include what you're trying to do), and that it's not possible for the
> ruby bindings to allow you to create (in Ruby) a derived class from a
> C++ class defined by wxwidgets. I could be wrong..

Well, can't speak for how useful it is with Ruby, as I haven't tried it
yet, wxWidgets is a very powerful GUI library, easily as featureful as
GTK2, QT3, etc. One strength of wxWindows is that it runs on all 3 major
platforms and uses native widgets on each (GDI on Windows, Cocoa on OS X,
GTK2 on *nix)