Skip to main content
1-Visitor
November 9, 2015
Question

Toolkit DLL used in VB.Net

  • November 9, 2015
  • 2 replies
  • 3672 views

Hello ,

I would like to access functions from c++ dll having toolkit API into VB.Net.

I am able to use dllimport properly for functions which does not have any of the toolkit API. With toolkit API, function does not work properly and gives Access Violation error.

Please suggest me on same. I can provide more details if require.

Regards

Ketan


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

2 replies

1-Visitor
November 20, 2015

Guys,

I have seen application with foreign GUI. Could be built in MFC. Any idea on this? Unfortunately, PTC technical support does not entertain foreign GUI queries.

Is this the right place for this question?

Thanks and Regards

Ketan

14-Alexandrite
February 15, 2016

Hi,

You need to export C++ method and import DLL using DLLImport in vb.net

Ex:

Exporting Sample C++ code:

EXPORT char* GetCurrentDrawingName()

{

     static char cDrwName[PRO_NAME_SIZE];

     //Do Your code here

      return cDrwName;

}

Importing sample vb.net code:

Module WrapperImport

<DllImport("CreoWrapper.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _

    Public Function GetCurrentDrawingName() As

End Function

End Module

Public Function GetCurrentDrawingName() As String

        Dim sReturn As String = -1

        sReturn = Marshal.PtrToStringAnsi(WrapperImport.GetCurrentDrawingName())

        Return sReturn

End Function

1-Visitor
February 20, 2016

Hi,

I had tried this way back. I was able to use function of dll by dllimport in VB.Net for functions which does not involve Toolkit API.

Are you able to use dll functions properly which is having at least one toolkit API?

Thanks and Regards

Ketan