Hide Table of Contents
CallBack Method (ISldWorks)

Allows an out-of-process executable or a SOLIDWORKS macro to call back a function in a SOLIDWORKS add-in DLL.

.NET Syntax

Visual Basic (Declaration) 
Function CallBack( _
   ByVal CallBackFunc As System.String, _
   ByVal DefaultRetVal As System.Integer, _
   ByVal CallBackArgs As System.String _
) As System.Integer
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim CallBackFunc As System.String
Dim DefaultRetVal As System.Integer
Dim CallBackArgs As System.String
Dim value As System.Integer
value = instance.CallBack(CallBackFunc, DefaultRetVal, CallBackArgs)
System.int CallBack( 
   System.string CallBackFunc,
   System.int DefaultRetVal,
   System.string CallBackArgs
System.int CallBack( 
&   System.String^ CallBackFunc,
&   System.int DefaultRetVal,
&   System.String^ CallBackArgs



Function to call


Default return value


Arguments to pass to the callback function

Return Value

Return value from the callback function, if it is called; DefaultRetVal if it is not called


To set the filename:

result = swApp.CallBack("pworks@miEval", 0, "RenderToFile Filename d:\image\xyz.jpg")


The CallBackFunc value contains the callback function to call. The syntax is:



  • dllname is the name of the add-in library as specified in your project .def file.

  • function is the name of the function that gets called by this method. It must be declared as an exportin your project .def file.

If the callback function is actually called, then the return value contains the value returned by the callback function, and the DefaultRetVal is not used.

If the callback function is not called, then the DefaultRetVal value is passed back from the API in the retval value. This allows the caller of this API to specify a return value that is different from any return value that the callback function might return so that it can tell if a problem occurred that caused the callback to never get called.

The CallBackArgs value contains the information to pass to the callback function. This value is untouched by the API and is passed through to the callback as a BSTR. Therefore, the format of what is inside of the string can be whatever the caller wants it to be. Handling and use of it is the sole responsibility of the callback function.


See Also

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   CallBack Method (ISldWorks)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2019 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.