Win32ole access violation
-
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:inmethod_missing'Ruby Code:
` require 'sci_noise3donline/Desktop/win32ole.so' if Sketchup.version.to_f <14
require 'win32ole' if Sketchup.version.to_f >13lib = 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
-
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 ) -
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. -
Have you tried this is a standalone version of Ruby? Just for comparison?
-
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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement