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.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.
> 
> 
> 

Since you're wanting to meddle in the windows API, you may want to use Win32API:
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=/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


-- 

----------

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