Imports System.Runtime.InteropServices
Public Class Form1
Declare Unicode Function DLLFunc Lib "DLLName.dll" ( _
ByVal hInstance As Integer, _
ByVal lpKeyFullName As String, _
ByVal lpDescriptor As MySubType) As Long ' As Integer???
<StructLayout(LayoutKind.Sequential)> _
Public Class MySubType
Public ChArray() As Char
Public p1 As UInteger
Public p2 As UInteger
Public p3 As UInteger
Public p4 As UInteger
Public p5 As UInteger
Public p6 As UInteger
End Class
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Err As Long
Dim Entry1 As New MySubType
ReDim Entry1.ChArray(10)
Err = DLLFunc(Handle, "test", Entry1)
End Sub
End Class
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)> Structure MySubType
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=108)> ChArray() As Char
Public p1 As UInteger
Public p2 As UInteger
Public p3 As UInteger
Public p4 As UInteger
Public p5 As UInteger
Public p6 As UInteger
End Structure
Private Declare Unicode DLLFunc Lib "DLLName.dll" ( _
ByVal hInstance As Integer, _
ByVal lpKeyFullName As String, _
ByVal lpDescriptor As MyType) As Integer
Private Declare Unicode Function GdbHimDevEntryGetDescriptor Lib "GdbHimServices.dll" ( _
ByVal hInstance As Integer, _
ByVal lpKeyFullName As String, _
<[In](), Out()> ByVal lpDescriptor As GDB_ENTRY_DESC_DT) As Integer
Function "GdbHimDevEntryGetValue" allows it?Question : Can I define an array of Get/Set descriptors in order to get more than a single value ?
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)> _
Public Class GDB_ENTRY_DESC_DT_1
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=44)> Public a_Name_AWC() As Char
Public b_Size_UL As UInteger
Public c_Address_UL As UInteger
Public d_Depth_UL As UInteger
Public e_Multiplicity_UL As UInteger
Public f_Bitmask_UL As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public g_Value_AUC() As Byte
Public h_Error_US As UShort
Sub New()
ReDim a_Name_AWC(43)
ReDim g_Value_AUC(7)
End Sub
End Class
Public Shared Function dgb_GetDescriptorANDValue(ByVal ParName As String) As UInteger
Dim Ptr2Dev As Integer = 0 'Unknown to me value, therefore a zero
Dim DevErr As UInteger
Dim Desc1(9) As GDB_ENTRY_DESC_DT_1
For i As Integer = 0 To Desc1.Length - 1
Desc1(i) = New GDB_ENTRY_DESC_DT_1
' Get Descriptor
DevErr = GdbHimDevEntryGetDescriptor(Ptr2Dev, ParName, Desc1(i))
'If DevErr <> 0 Then Return DevErr
Next
' Get Values
DevErr = GdbHimDevEntryGetValue(Ptr2Dev, Desc1(0), Desc1.Length)
Return (DevErr)
End Function
How can i open a new project and to add an existing form from early project.
Just adding the design and vb files of the form to the new project not helps.
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1