method

new

Importance_2
v2_4_6 - Show latest stable - 0 notes - Class: WIN32OLE_RECORD
new(p1, p2) public

Returns WIN32OLE_RECORD object. The first argument is struct name (String or Symbol). The second parameter obj should be WIN32OLE object or WIN32OLE_TYPELIB object. If COM server in VB.NET ComServer project is the following:

Imports System.Runtime.InteropServices
Public Class ComClass
    Public Structure Book
        <MarshalAs(UnmanagedType.BStr)> _
        Public title As String
        Public cost As Integer
    End Structure
End Class

then, you can create WIN32OLE_RECORD object is as following:

require 'win32ole'
obj = WIN32OLE.new('ComServer.ComClass')
book1 = WIN32OLE_RECORD.new('Book', obj) # => WIN32OLE_RECORD object
tlib = obj.ole_typelib
book2 = WIN32OLE_RECORD.new('Book', tlib) # => WIN32OLE_RECORD object
Show source
Register or log in to add new notes.