Jump to content

Recommended Posts

Posted

Hi There,

I've been working on a DLL for some time and unfortunately I'm not getting anywhere. Maybe someone knows a solution?
The idea is to read and edit info in a DLL. (The DLL controls a robot arm and gives info whether the arm is in place and via a pulse and values the arm can be moved to the next position).
I managed to create programmes via Visual Studio that can perform this.
1: Via the DotNetAll.au3, it is possible to process Visual Basic programmes in AutoIt. 
In my Visual Studio, I can specify the reference to the DLL, create an exe and then the software works (see below).
In Visual Basic that doesn't work, because I can't specify a reference to the DLL there.
Question: Is there a version of DotNetAll.au3 that can also process Visual Studio files?
2: Then I tried to read/edit the DLL directly from AutoIt using the CLRv3a. (see below)
Reading out the name works, but I can't get any further.
Can anyone help me a little further?

 

Software made in Visual Studio (works as exe file, sets the position of the robotarm)

Imports System

Module program
    Public trio As TrioMotion.TrioPC_NET.TrioPC = New TrioMotion.TrioPC_NET.TrioPC
    Sub Main()
        trio.HostAddress = "127.0.0.1"
        If trio.IsOpen(2) Then
            trio.Close(2)
        End If
        trio.Open(2, 3240)

        Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\apps\ams\Q2\liaison\vr_set.txt")
            MyReader.TextFieldType = FileIO.FieldType.Delimited
            MyReader.SetDelimiters("|")
            Dim currentRow As String()
            Dim rij As Double
            rij = 0
            While Not MyReader.EndOfData
                Try
                    currentRow = MyReader.ReadFields()
                    Dim currentField As String
                    For Each currentField In currentRow
                        trio.SetVr(rij, currentField)
                        rij = rij + 1
                    Next
                Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
                    MsgBox("Line " & ex.Message & "is not valid and will be skipped.")
                End Try
            End While
        End Using
        trio.Close(2)
    End Sub
End Module

Software made in AutoIt to read the DLL (only the FullName is given)

#AutoIt3Wrapper_UseX64=n
#include "CLR.Au3"
#include <StructureConstants.au3>
#include <WinAPI.au3>

local $trio,$value

  Local $oDomain=_CLR_GetDefaultDomain()
  ConsoleWrite("$oDomain: " & IsObj($oDomain) & @CRLF)

  Local $oXPTable = _CLR_LoadLibrary("C:\afval\Q2\TrioPC_NET.dll")

  Local $sFullName
  $oXPTable.get_FullName( $sFullName )
  ConsoleWrite(@CRLF)
  ConsoleWrite( "$sFullName = " & $sFullName & @CRLF & @CRLF )

  $oXPTable.TrioMotion.TrioPC_NET.TrioPC.HostAddress = "127.0.0.1"

  $oXPTable.GetVr(4, $value)
  ConsoleWrite(@CRLF)
  ConsoleWrite( "$VR = " & $value & @CRLF & @CRLF )

;  local $trio=TrioMotion.TrioPC_NET.TrioPC
;  local $trio=TrioMotion.$oXPTable.TrioPC
    $oXPTable.TrioMotion.TrioPC_NET.TrioPC.GetVr(4,$value)
  ConsoleWrite(@CRLF)
  ConsoleWrite( "$VR = " & $value & @CRLF & @CRLF )
Exit

 

TrioPC_NET.dllFetching info...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...