Hi all, As a response to the feature request http://rubyforge.org/tracker/index.php?func=detail&aid=25792&group_id=85&atid=414, I have been struggling with the win32ole in these days. The implementation is almost done except for some event handling. It passed all the test codes provided with the MRI win32ole module except for test_win32ole_event.rb I have got stuck in IConnectionPoint::Advise right now. If you are familiar with the COM event handling, please give me some advice. The code is available at http://121.78.227.9/win32-ole/win32ole.rb Regards, Park Heesob
On Thu, May 14, 2009 at 10:43 PM, Heesob Park <phasis at gmail.com> wrote:> Hi all, > > As a response to the feature request > http://rubyforge.org/tracker/index.php?func=detail&aid=25792&group_id=85&atid=414, > I have been struggling with the win32ole in these days. The > implementation is almost done except for some event handling. > It passed all the test codes provided with the MRI win32ole module > except for test_win32ole_event.rb > > I have got stuck in IConnectionPoint::Advise right now. If you are > familiar with the COM event handling, please give me some advice. > > The code is available at http://121.78.227.9/win32-ole/win32ole.rbExcellent work! I did notice one mistake: # Wrong function name SysFreeString = Win32::API.new(''SysAllocString'', ''L'', ''V'', ''oleaut32'') Also, most of the functions you need are in the Windows::COM::Automation module. A few are missing, so I''ve added those, along with the constant enum values. I did notice a prototype difference for SysAllocString. I return the string, but you want the address? I''ll take a look at the IConnectionPoint::Advise code soon. Regards, Dan
Hi, ----- Original Message ----- From: "Daniel Berger" <djberg96 at gmail.com> To: "Development and ideas for win32utils projects" <win32utils-devel at rubyforge.org> Sent: Saturday, May 16, 2009 8:04 AM Subject: Re: [Win32utils-devel] Pure Ruby win32-ole library> On Thu, May 14, 2009 at 10:43 PM, Heesob Park <phasis at gmail.com> wrote: >> Hi all, >> >> As a response to the feature request >> http://rubyforge.org/tracker/index.php?func=detail&aid=25792&group_id=85&atid=414, >> I have been struggling with the win32ole in these days. The >> implementation is almost done except for some event handling. >> It passed all the test codes provided with the MRI win32ole module >> except for test_win32ole_event.rb >> >> I have got stuck in IConnectionPoint::Advise right now. If you are >> familiar with the COM event handling, please give me some advice. >> >> The code is available at http://121.78.227.9/win32-ole/win32ole.rb > > Excellent work! > > I did notice one mistake: > > # Wrong function name > SysFreeString = Win32::API.new(''SysAllocString'', ''L'', ''V'', ''oleaut32'') >I fixed it.> Also, most of the functions you need are in the > Windows::COM::Automation module. A few are missing, so I''ve added > those, along with the constant enum values. > > I did notice a prototype difference for SysAllocString. I return the > string, but you want the address? >Yes. The SysAllocXXX should return the address. BTW, you mistacked RegEnumKeyEx''s prototype in registry.rb ''LLPPPPP'' should be ''LLPPPPPP'' Also LoadTypeLibEx''s prototype ''PPP'' should be ''PLP''.> I''ll take a look at the IConnectionPoint::Advise code soon. >I guess it is related with the callback function implementation. When I tested with the native C function, it works. Thanks, Park Heesob
On Fri, May 15, 2009 at 6:22 PM, Park Heesob <phasis at gmail.com> wrote:> Hi,<snip>>> Also, most of the functions you need are in the >> Windows::COM::Automation module. A few are missing, so I''ve added >> those, along with the constant enum values. >> >> I did notice a prototype difference for SysAllocString. I return the >> string, but you want the address? >> > Yes. The SysAllocXXX should return the address. > > BTW, you mistacked RegEnumKeyEx''s prototype in registry.rb > ''LLPPPPP'' should be ''LLPPPPPP'' > Also LoadTypeLibEx''s prototype ''PPP'' should be ''PLP''.I''ve corrected the mistakes you mentioned, thank you. I''ve released windows-pr 1.0.4 that should have everything you need now. Please let me know if there''s anything I''ve missed.>> I''ll take a look at the IConnectionPoint::Advise code soon. >> > ?I guess it is related with the callback function implementation. When I > tested with the native C function, it works.Perhaps we could borrow some ideas from that other code that used asm? Do you have an easy test case? Regards, Dan
Hi, 2009/5/16 Daniel Berger <djberg96 at gmail.com>:> On Fri, May 15, 2009 at 6:22 PM, Park Heesob <phasis at gmail.com> wrote: >> Hi, > > <snip> > >>> Also, most of the functions you need are in the >>> Windows::COM::Automation module. A few are missing, so I''ve added >>> those, along with the constant enum values. >>> >>> I did notice a prototype difference for SysAllocString. I return the >>> string, but you want the address? >>> >> Yes. The SysAllocXXX should return the address. >> >> BTW, you mistacked RegEnumKeyEx''s prototype in registry.rb >> ''LLPPPPP'' should be ''LLPPPPPP'' >> Also LoadTypeLibEx''s prototype ''PPP'' should be ''PLP''. > > I''ve corrected the mistakes you mentioned, thank you. I''ve released > windows-pr 1.0.4 that should have everything you need now. Please let > me know if there''s anything I''ve missed. > >>> I''ll take a look at the IConnectionPoint::Advise code soon. >>> >> ?I guess it is related with the callback function implementation. When I >> tested with the native C function, it works. > > Perhaps we could borrow some ideas from that other code that used asm? > Do you have an easy test case? >Finally I have finished the first release of pure Ruby version of win32-ole including event handling. Of course, there are still some untested bugs. I have done the code refactoring of the callback function of the win32-api module inevitably to support user defined event handler. Although the api.c code looks uncomfortable, it''s my best choice for now. For me, using inline assembly seems dependent on compiler or cpu and unstable. The code is available at http://121.78.227.9/win32-ole/ Regads, Park Heesob
Hi, 2009/5/16 Daniel Berger <djberg96 at gmail.com>:> On Fri, May 15, 2009 at 6:22 PM, Park Heesob <phasis at gmail.com> wrote: >> Hi, > > <snip> > >>> Also, most of the functions you need are in the >>> Windows::COM::Automation module. A few are missing, so I''ve added >>> those, along with the constant enum values. >>> >>> I did notice a prototype difference for SysAllocString. I return the >>> string, but you want the address? >>> >> Yes. The SysAllocXXX should return the address. >> >> BTW, you mistacked RegEnumKeyEx''s prototype in registry.rb >> ''LLPPPPP'' should be ''LLPPPPPP'' >> Also LoadTypeLibEx''s prototype ''PPP'' should be ''PLP''. > > I''ve corrected the mistakes you mentioned, thank you. I''ve released > windows-pr 1.0.4 that should have everything you need now. Please let > me know if there''s anything I''ve missed. >I uploaded a new version of win32ole.rb which applied the latest windows-pr. It is http://121.78.227.9/win32-ole/win32ole.rb.new Following two files should be modified to work properly. automation.rb API.new(''SafeArrayCreate'', ''LLP'', ''L'', ''oleaut32'') API.new(''SafeArrayCreateVector'', ''LLL'', ''L'', ''oleaut32'') national.rb begin API.new(''EnumTimeFormatsEx'', ''KSLP'', ''B'') API.new(''GetCurrencyFormatEx'', ''PLPPPI'', ''I'') API.new(''GetDateFormatEx'', ''SLPSPIS'', ''I'') rescue Win32::API::LoadLibraryError # Windows Vista or later end Regards, Park Heesob
On Tue, May 19, 2009 at 7:42 PM, Heesob Park <phasis at gmail.com> wrote:> Hi, > > 2009/5/16 Daniel Berger <djberg96 at gmail.com>: >> On Fri, May 15, 2009 at 6:22 PM, Park Heesob <phasis at gmail.com> wrote: >>> Hi, >> >> <snip> >> >>>> Also, most of the functions you need are in the >>>> Windows::COM::Automation module. A few are missing, so I''ve added >>>> those, along with the constant enum values. >>>> >>>> I did notice a prototype difference for SysAllocString. I return the >>>> string, but you want the address? >>>> >>> Yes. The SysAllocXXX should return the address. >>> >>> BTW, you mistacked RegEnumKeyEx''s prototype in registry.rb >>> ''LLPPPPP'' should be ''LLPPPPPP'' >>> Also LoadTypeLibEx''s prototype ''PPP'' should be ''PLP''. >> >> I''ve corrected the mistakes you mentioned, thank you. I''ve released >> windows-pr 1.0.4 that should have everything you need now. Please let >> me know if there''s anything I''ve missed. >> > I uploaded a new version of win32ole.rb which applied the latest windows-pr. > It is ?http://121.78.227.9/win32-ole/win32ole.rb.new > > Following two files should be modified to work properly. > > automation.rb > > ? ? ? ? API.new(''SafeArrayCreate'', ''LLP'', ''L'', ''oleaut32'') > ? ? ? ? API.new(''SafeArrayCreateVector'', ''LLL'', ''L'', ''oleaut32'') > > national.rb > > ? ? ?begin > ? ? ? ? API.new(''EnumTimeFormatsEx'', ''KSLP'', ''B'') > ? ? ? ? API.new(''GetCurrencyFormatEx'', ''PLPPPI'', ''I'') > ? ? ? ? API.new(''GetDateFormatEx'', ''SLPSPIS'', ''I'') > ? ? ?rescue Win32::API::LoadLibraryError > ? ? ? ? # Windows Vista or later > ? ? ?endThanks Heesob, I''ve applied these changes in CVS. I also noticed I accidentally set VARIANT_TRUE to 1 instead of -1. I''ve updated that as well. I''ll try to get a release out very soon. Regards, Dan