Win32 OLE event sink & Quit

ruby

    Sponsored Links

    Next

  • 1. Getting more descriptive ERB errors
    I see that Rails provides very useful and descriptive ERB errors, showing exactly which part of the template caused the error. Is there anyway I can get this behavior for general (non rails/ActionView) erb templates? I'm not opposed to requiring or mixing in certain chunks of rails (or even copying and pasting code) - just not sure how. (Also, I know Rails has compilation and caching - anyway to do this?)
  • 2. log4r - context (NDC)
    Is there anyway to set a context for log4r? log4j has somethign like NDC Basically, in a web app, I'd like to correlate messages for the same client. I'd like to do something like context = "#{user.ip} #{user.name}" and have it automatically appended to each logging message, or, even better, appended whenever the context changes (that is, if there are 5 messages in a row from the same user, no need to keep repeating the context) is this available?
  • 3. if File.exist? does not work
    I got like: if File.exist? "#{RAILS_ROOT}/public/images/#{property.id}/middle/#{image.name}" File.unlink "#{RAILS_ROOT}/public/images/#{property.id}/middle/#{image.name}" end why it does not work ? error No such file or directory - script/../config/../public/images/144/middle/cfa9a31932bea2904485b56294764a6b.jpg
  • 4. imginfo = Magick::Image.read(@params['image']['name']) .first
    I try do upload of image but before I need to check the size of it so I made the form to uplaod <%= form_tag({:action=>'upload', :id => @property.id }, :multipart => true )%> <%= file_field 'image', 'name' %><br> <%= submit_tag "send" %> <%= end_form_tag %> and in controller I have imginfo = Magick::Image.read(@params['image']['name']) .first but the params @params['image']['name'] is wrong ???? unable to open image `#<File:0xb75bfa00>': No such file or directory: I save this file like that so I use paraqs the same ?? #File.open("#{RAILS_ROOT}/public/images/#{params[:id]}/oryg/#{new_image.name}", "w") { |f| f.write(@params['image']['name'].read) }

Win32 OLE event sink & Quit

Postby Philippe Lang » Wed, 23 Apr 2008 02:28:35 GMT

Hi,

I'm trying to setup a win32 ole callback that would notify me that the
application that was launched has quit, in order to release the process
from memory.

The code I'm playing with looks like:

      @@access = WIN32OLE.new('Access.Application')
      @@access.OpenCurrentDatabase(@database)

      begin

        @@event_sink = WIN32OLE_EVENT.new(@@access, <???>)
        stop_listening = false
        @@event_sink.on_event("Quit") do |*args| 
        	puts "Access application has quit!"
        	stop_listening = true
        end

        WIN32OLE_EVENT.message_loop until stop_listening

      rescue Exception => e
        puts e.message
      end

I cannot find any event interface that would notify me that the MS
Access application has quit. I checked with "Simple OLE Browser", but no
luck. And most examples regarding WIN32OLE_EVENT are done with Internet
Explorer.

Does anyone have an idea?

Thanks,

Philippe Lang


Re: Win32 OLE event sink & Quit

Postby Gordon Thiesfeld » Wed, 23 Apr 2008 04:33:45 GMT

On Mon, Apr 21, 2008 at 12:28 PM, Philippe Lang



WMI Events?  Here's a VBScript example that will notify when a process
terminates.

 http://www.**--****.com/ 

On a side note, this is my third WMI related post in two days.  I hope
I'm not annoying anyone ;-)

hth,

Gordon


Re: Win32 OLE event sink & Quit

Postby Philippe Lang » Wed, 23 Apr 2008 15:31:37 GMT



 http://www.**--****.com/ 
rue

Hi,

In fact, I'd like to get notified when the MS Access database quits
because as long as there is a WIN32OLE object pointing at it, the
process does not terminate. So I'm afraid this WMI script (the link does
not work by the way) won't help here!

Philippe



Similar Threads:

1.passing optional argument to win32 ole subsystem

Hi all,
I am trying to embed a html document in Excel document using Win32OLE.
The VBA Excel reference talks about this by using the OleObject Add method.
However I am not sure how do I pass the optional argument in ruby which OLE
will understand. Following is the snippet of the sample from VBA refernce.

==============
|Set myDocument = Worksheets(1)
myDocument.Shapes.*AddOLEObject* Left:=100, Top:=100, _ Width:=200, 
Height:=300, _ FileName:="c:\my documents\testing.doc", link:=True|
==============


I tried passing null, but it failed miserably. I am not sure if I pass 
some argument incorrectly
or the method I am using to pass the arguments is incorrect.
Can somebody let me know the exact syntax in ruby to make this call 
successful.
Any relevant pointers will be appreciated.

Thanks and Regards,
Manish


2.Win32 extensions??? not OLE

3.Win32 COM events

Hello All.

I want to translate the following VB code to Ruby. Does anybody know
how to handle these events?

Dim WithEvents myOBJ As SomeOBJ

Private Sub myOBJ_SomeEvent(ByVal nCommand As Integer,
                                  ByRef cResult As String)

---
Also things like this...

Event SomeFunction(ByVal n as Integer)

SomeFunction(5)

Thanks in Advance.

4.[ANN] win32-event 0.2.0

5.[ANN] win32-event 0.1.0

6. FXRuby and win32 events

7. win32::changenotify and multiple events

8. the ruby kitchen sink



Return to ruby

 

Who is online

Users browsing this forum: No registered users and 40 guest