AnsweredAssumed Answered

ADDIN created by VB6.0 cannot be loaded in Solidworks2016?

Question asked by Zheng As on Jun 14, 2020
Latest reply on Jun 18, 2020 by John Burrill

Hello everyone! Why can't SW ADDIN created under VB6.0 be loaded in Solidworks2016?


'Library file referenced

'“SolidWorks exposed Type Libraries For add-in Use" 
'”SolidWorks 2016 Type Libray“ 
'”SolidWorks Consant Type library" 


code show as below

Implements SWPublished.swAddin
Dim swApp As SldWorks.SldWorks
Dim swCookie As Long
Dim swToolbarID As Long
Dim doctype As Long
Dim ii As Long


Private Function SwAddin_ConnectToSW(ByVal ThisSW As Object, ByVal Cookie As Long) As Boolean

Dim bRet As Boolean

Set swApp = ThisSW

swCookie = Cookie 

bRet = swApp.SetAddinCallbackInfo(App.hInstance, Me, swCookie)

ii = swApp.AddMenu(swDocPART, "CreateCube", 5)

swApp.AddMenuItem2 swDocPART, swCookie, "CreateCube", 1, "Block_MenuCallback", "Create a Cube", "Create a Cube"
SwAddin_ConnectToSW = True
End Function


Public Sub Block_MenuCallback()
MsgBox "Create a Cube"
End Sub


Private Function SwAddin_DisconnectFromSW() As Boolean

Dim bRet As Boolean

bRet = swApp.RemoveMenu(swDocPART, "CreateCube", "")

bRet = swApp.RemoveToolbar2(swCookie, swToolbarID)

Set swApp = Nothing 

SwAddin_DisconnectFromSW = True 

End Function