[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Ruby DL Setup to send and receive windows messages?

awertyui

5/2/2005 4:55:00 PM

I am trying to send and receive messages between a ruby program and
another program. The end goal is to be able to send a message to the
other program to request data and the other program returns a message
saying where the data file is using Atom tables. Could anyone point me
in the right direction? I have been trying to use ruby dl but I never
seem to set it up right with anyting more complicated than the sleep
function. I always get this error "unexpected type 'W'" or one
similar to it. Here is what I have been trying so far with no luck.


require 'dl/import'
require 'dl/struct'
require 'dl/types'

module Win32
extend DL::Importable
dlload 'user32.dll'

typealias "WPARAM", "UINT"
typealias "LPARAM", "UINT"

POINT = struct [
"ULONG x",
"ULONG y"
]


MSG = struct [
"HWND hwnd",
"UINT message",
"WPARAM wParam",
"LPARAM lParam",
"DWORD time",
"POINT pt"
]

typealias "LPMSG","MSG*"
extern 'BOOL PeekMessage(LPMSG,HWND,UINT,UINT,UINT)'
extern 'UINT SendMessage(HWND,UINT,WPARAM,LPARAM)'


end
line = gets

1 Answer

Takaaki Tateishi

5/3/2005 12:23:00 AM

0

awertyui@gmail.com wrote:
> POINT = struct [
> "ULONG x",
> "ULONG y"
> ]
>
>
> MSG = struct [
> "HWND hwnd",
> "UINT message",
> "WPARAM wParam",
> "LPARAM lParam",
> "DWORD time",
> "POINT pt"
> ]

As the type POINT can't be defined internally, you can't use it in the definition of "MSG".
I think the following definition will do for the purpose.

MSG = struct [
"HWND hwnd",
...
"ULONG pt_x",
"ULONG pt_y",
]

--
Takaaki Tateishi <ttate@ttsky.net>