sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Win32ole access violation

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 4 Posters 573 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sonjachr
      last edited by

      I am having problems with win32ole, using Sketchup 2014, 2015
      I get the following error message:

      Error: (in OLE method AddMyValues': ) OLE error code:80004003 in mscorlib Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist. HRESULT error code:0x80020009 Exception occurred. C:/Users/Christiansen/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/sci_noise3donline/sci_menu_methods.rb:791:in method_missing'

      Ruby Code:

      ` require 'sci_noise3donline/Desktop/win32ole.so' if Sketchup.version.to_f <14
      require 'win32ole' if Sketchup.version.to_f >13

      lib = WIN32OLE.new('ClassLibrary1.MyFunctions')
      tt=lib.AddMyValues()
      puts tt`

      VB.net code: for ClassLibrary1.dll
      [pre:1774dfzw]Imports System.Windows.Forms
      Public Class MyFunctions
      Public Function AddMyValues()
      Dim Result As Double
      Result = 20
      MessageBox.Show(Result)
      Return Result
      End Function
      End Class[/pre:1774dfzw]

      ClassLibrary1.dll is registered and visible

      it is working in Sketchup 2013 even with MessageBox.Show(Result)
      and it is working in Sketchup 2014, 2015 when I eliminate MessageBox.Show(Result)

      Any ideas?

      Your help is very much appreciated

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        First idea, use the Ruby API UI.messagebox() method, not the one in VB.

        caption = " Result" UI.messagebox( "\n The result is: #{tt}", MB_MULTILINE, caption )

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • S Offline
          sonjachr
          last edited by

          Thanks for the reply.
          The messagebox was just a simple example. What I want is to use some complex vb.net forms, which do already exist as a frontend for a calculation System.
          I can invoke all functions in this calculation System using win32ole, but just not those showing forms and messageboxes. It does work with Sketchup 2013, where I can use a win23ole.so , located in my plugins folder. But with Sketchup 2014/2015 I have to use the win23ole.so shipped with Sketchup. I have no clue how to solve this Problem.
          Help is very much appreciated.

          1 Reply Last reply Reply Quote 0
          • tt_suT Offline
            tt_su
            last edited by

            Have you tried this is a standalone version of Ruby? Just for comparison?

            1 Reply Last reply Reply Quote 0
            • icehuliI Offline
              icehuli
              last edited by

              I think you need to use another thread for the WinForm windows, e.g MessageBox. I checked the following code. It works. It actually makes more sense to let the WinForm window in a separate thread other than the Sketchup's thread.

              Imports System.Windows.Forms
              Public Class MyFunctions
              
                  Private Sub showMessage(ByVal msg As String)
                      MessageBox.Show(msg)
                  End Sub
              
                  Public Function AddMyValues()
                      Dim Result As Double
                      Result = 20
              
                      Dim t1 As New Threading.Thread(AddressOf showMessage)
                      t1.Start(Result)
              
                      Return Result
                  End Function
              End Class
              
              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement