Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
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
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
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
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
hello,
I am new with toolkit ,do you have some documents for visual basic user guide, I can't find it anyway.
thanks.
Leo Zhang wrote:
I am new with toolkit ,do you have some documents for visual basic user guide, I can't find it anyway.
Do you have the Visual Basic API installed? It should be under Common Files\vbapi .
If you do, then the documentation is under Common Files\vbapi\vbapidoc .
|+| M a r k |+|
Also you can find examples or sample code to startup at installation directory @ C:\Program Files\PTC\Creo 2.0\Common Files\M120\vbapi\vbapi_examples