API, addins, FileSavePostNotify

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?

Reply to
Markku Lehtola
Loading thread data ...

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.

Reply to
That70sTick

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")?

Reply to
That70sTick

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

Reply to
Markku Lehtola

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.