Subject: [ruby-ffi] Re: Newbie ? about porting code from VB to Ruby |
From: JesseFair |
Date: 6/14/11 12:27 PM |
To: ruby-ffi |
Hi Charles, Thanks for taking the time to provide this solution. In my attempt to implement the solution I am recieving a return_code = 11 when attempting to connect to the Presentation Space. According to the documentation that return code means the following: WHLLUNAVAILABLE Connect request failed, specified session is unavailable (already in use). It appears I am able to run WinHLLAPIStartup because when I check the contents of data[:wVersion] & data[:szDescription] they appear to be correct. I am attempting to connect to the Presentation Space with the below call: # Connect to presentation Space function.write_uint16(1) string = "A" length.write_uint16(1) return_code.write_uint16(0) hold = HLLAPI::WinHLLAPI(function, string, length, return_code) The above does not work and when I try to run other commands that require a connection to the Presentation Space I get a return code of 1 or WHLLNOTCONNECTED. I am able to run other WinHLLAPI functions that dont require a connection to the presentation space such as pause. Once again thanks a bunch for your help. Thanks Jesse On Jun 8, 4:14 pm, Charles Strahan <charles.c.stra...@gmail.com> wrote:
https://gist.github.com/1015672 I tried to annotate the sample as well as I could. If anything is unclear, or doesn't work, please let me know. Unfortunately, I do not have the HLLAPI lib to test with, so I had to base that code off of the docs and some .NET samples. HTH, -Charles <https://gist.github.com/1015672> On Wed, Jun 8, 2011 at 1:11 PM, JesseFair <jfa...@gmail.com> wrote:Hi Jesse, Welcome to the Ruby community! I think this will work for you:I tried Win32API as well but cant find out how to pass the cutom data type WHLLAPIDATA that the WinHLLAPIStartup function is expecting. Being new to Ruby I cant find a way to construct something that acts similar to the above code -.. i.e. custom data types. I was able to get the examples up and working but they only use simple data types such as int and string.
<b.cand...@pobox.com> wrote:On Jun 8, 1:18 am, candlerbI am not a Windows expert, but have you tried looking at Win32API instead of FFI? This may be all that you need. There are plenty of examples if you google for them.
http://www.ruby-doc.org/docs/ProgrammingRuby/html/win32.htmlhttp://ww...- Hide quoted text -- Show quoted text -