Sending and receiving windows messages with ruby.

A

awertyui

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.htm#handlewm .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.
 
S

Shad Sterling

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.htm#handlewm .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.
=20
=20
=20

Since you're wanting to meddle in the windows API, you may want to use Win3=
2API:
http://phrogz.net/ProgrammingRuby/lib_windows.html#Win32API
(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=3D/library/en-us/winprog/=
winprog/windows_api_start_page.asp
(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


--=20
 
T

Tyler Eaves

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top