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
2016 is 64 bit only. VB6 cannot create 64 bit dll's
You will have to port it to .Net. You may qualify for the free Community edition of Visual Studio