API, addins, FileSavePostNotify

Aug 24, 2005 3 Replies

Hi,



just exploring how to create addins with VB6 and can't figure out how to handle drawing events:



Dim WithEvents swDrawing As SldWorks.DrawingDoc



Private Function swDrawing_FileSavePostNotify(ByVal saveType As Long, ByVal FileName As String) As Long MsgBox "works" End Function


this gives me nothing, no error, nothing. If I use FileOpenNotify it works...what's the trick with FileSavePostNotify?


I've found the performance of "_FileSavePostNotify" to be spotty at times. It's almost as if it can plowed under by other activity. For example, if all files in an assembly are saving, sometimes the notification gets missed.

I have a macro-to-API project that may interest you.

One more thing to check:

When you invoke "WithEvents" to Dim an object, that object's events should be available in the drop-down list at the top of your code window. If the object and events aren't there, something isn't working right.

Are other notifications working? Have you tried defining your SolidWorks application object using WithEvents, as well (i.e. "Dim WithEvents swApp as SldWorks.SldWorks")?

Got some help from SW Api-support:

You have to use DocumentLoadNotify to reattach to event handlers, then it works. Code is the same when you attach to the document

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required